Numerical representation of dates

Kowalski

Registered User.
Local time
Today, 21:48
Joined
Jul 5, 2007
Messages
121
Hi
I'm looking to get the base numerical representation of a date in Access 2010.
For example: Today's date (2011/07/04) should be 40728
In Access 97 it was possible to run Format(Format(MyDate)) and you had it.
But not in Access 2010. Running the double Format in Access 2010 does not do the same thing.
The reverse does however work in 2010: If you run Format(40728, "Short Date") it will return 2011/07/04, but I want to pass the date and get the number.
 
Hi
I'm looking to get the base numerical representation of a date in Access 2010.
For example: Today's date (2011/07/04) should be 40728
In Access 97 it was possible to run Format(Format(MyDate)) and you had it.
But not in Access 2010. Running the double Format in Access 2010 does not do the same thing.
The reverse does however work in 2010: If you run Format(40728, "Short Date") it will return 2011/07/04, but I want to pass the date and get the number.

You shouldn't delete the post, you should post the answer so others may benefit. You showed this as why you deleted the post:
Found Answer: is CDbl(Date())
However, for the date part you would probably be better off using CLng(Date()) instead since that will give you the proper integer for the date whereas the Double could end up with rounding issues depending on what you were wanting to use it for. CDbl would be a way to get the date and time from a field as the decimal is the time. But if it works for you with CDbl, that's fine.
 

Users who are viewing this thread

Back
Top Bottom