DateDifferenceMBS class

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

DateDifferenceMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Basic MBS Util Plugin 7.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
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

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!

This class has no sub classes.

Some useful global functions for this class:

Some examples using this class:

Blog Entries

Release notes


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


DatagramMBS   -   DateTimePicker


💬 Ask a question or report a problem