Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

DateDifferenceMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Basic MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: A class to calculate the difference between two dates.
Example:
// calculate difference between now and a date in 2008.

dim d as date
dim r as DateDifferenceMBS
dim s as string
dim c as Clipboard

d=new date
d.Year=2008
d.Month=7
d.Day=2
d.Hour=10
d.Minute=48
d.Second=22

dim e as new date // today

r=new DateDifferenceMBS(d, e)

s= "Years: "+str(r.Year)+EndOfLine
s=s+"Months: "+str(r.month)+EndOfLine
s=s+"Days: "+str(r.day)+EndOfLine
s=s+"Hours: "+str(r.hour)+EndOfLine
s=s+"Minutes: "+str(r.Minute)+EndOfLine
s=s+"Seconds: "+str(r.Second)+EndOfLine

MsgBox s
Notes:
Calculates the difference between the older and newer date. The dates are sorted, so the difference is always a positive.
You can see Swap property to see if first date is after second date.

This class allows you to know exactly how many months/years are between two dates. Something that TotalSeconds calculations will not give you!

Feedback, Comments & Corrections

This class has no sub classes.

Some useful global functions for this class:

  • DifferenceMBS(extends StartDate as date, EndDate as date) as DateDifferenceMBS

Some examples which use this class:


The items on this page are in the following plugins: MBS Util Plugin.


DatagramMBS   -   DB2MBS




Links
MBS Xojo Chart Plugins