Date is not an Integer in VB(A), it is a Double.
You can get a Date's value by passing it to CDbl()
.
CDbl(Now()) ' 40877.8052662037
From the documentation:
The 1900 Date System
In the 1900 date system, the first day that is supported is January 1,
1900. When you enter a date, the date is converted into a serial number that represents the number of elapsed days starting with 1 for
January 1, 1900. For example, if you enter July 5, 1998, Excel
converts the date to the serial number 35981.
So in the 1900 system, 40877.805...
represents 40,876 days after January 1, 1900 (29 November 2011), and ~80.5% of one day (~19:19h). There is a setting for 1904-based system in Excel, numbers will be off when this is in use (that's a per-workbook setting).
To get the integer part, use
Int(CDbl(Now())) ' 40877
which would return a LongDouble with no decimal places (i.e. what Floor()
would do in other languages).
Using CLng()
or Round()
would result in rounding, which will return a "day in the future" when called after 12:00 noon, so don't do that.