Could someone help me how to subtract 2 Dates?
The format of the Date is "mm/d/yyyy"
Thanks.
Printable View
Could someone help me how to subtract 2 Dates?
The format of the Date is "mm/d/yyyy"
Thanks.
Dates do not have a format, only Strings (which includes tooltips for variables in the VB editor) have a format. Are you using Strings for this, or are they actually Dates?
Also, given two dates (perhaps tomorrow and yesterday) and what kind of result are you after?
Declare three double variables.
Convert your string to date.
Convert date to double.
Subtract the two.
Dim D1 as double, D2 as double
Dim DDiff as double
D1 = cdbl(cdate("01/01/2011")
D2 = cdbl(cdate("12/18/2010")
DDiff = D1 - D2
Sorry I forgot the rightmost parenthesis
Dim D1 as double, D2 as double
Dim DDiff as double
D1 = cdbl(cdate("01/01/2011"))
D2 = cdbl(cdate("12/18/2010"))
DDiff = D1 - D2
Why not just use the DateDiff function?