Platforms to show: All Mac Windows Linux Cross-Platform

DateDifferenceMBS.Calc(StartDate as date, EndDate as date) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Basic MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: Calculates the difference between two dates.
Example:
dim d as date
dim e 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

e=new date
e.Year=2010
e.Month=7
e.Day=1
e.Hour=10
e.Minute=36
e.Second=0

r=new DateDifferenceMBS

if r.Calc(d,e) then

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

// shows: "Years: 1 Months: 11 Days: 29 Hours: 22 Minutes: 47 Seconds: 38"
end if
Notes:
Returns false on any errors and true on success.
Valid only for dates from the gregorian calendar.
Sets ready property.

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.

See also:

Feedback, Comments & Corrections

DateDifferenceMBS.Calc(StartDate as dateTime, EndDate as dateTime) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Basic MBS Util Plugin 19.5 Yes Yes Yes Yes No
Function: Calculates the difference between two dates.
Notes:
Returns false on any errors and true on success.
Valid only for dates from the gregorian calendar.
Sets ready property.

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.

Please make sure both dates are in the same timezone.

See also:

Feedback, Comments & Corrections

DateDifferenceMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Basic MBS Util Plugin 8.3 Yes Yes Yes Yes No
Function: The dummy constructor doing nothing.

See also:

Feedback, Comments & Corrections

DateDifferenceMBS.Constructor(StartDate as date, EndDate as date)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Basic MBS Util Plugin 8.3 Yes Yes Yes Yes No
Function: Calculates the difference between two dates.
Notes: Internally calls Calc and sets ready property.

See also:

Feedback, Comments & Corrections

DateDifferenceMBS.Constructor(StartDate as dateTime, EndDate as dateTime)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Basic MBS Util Plugin 19.5 Yes Yes Yes Yes No
Function: Calculates the difference between two dates.
Notes:
Internally calls Calc and sets ready property.
Please make sure both dates are in the same timezone.

See also:

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS Xojo blog