converting dates to sequential number

  • Thread starter Thread starter JaneCline
  • Start date Start date
J

JaneCline

I need to convert a date field to the sequential number
the computer assigns to it. What is that function?
 
Dates are store like a Double number with the integral part represents the
number of days since 31/Dec/1899. Thus, you can simply use the Format
Property or Format function to get this number.

For example (from the Debug window):

?Format(Date(), "0")
38143

i.e. today 05/Jun/2004 is 38143 days since 31/Dec/1899.
 
Van,

The reason I prefer CLng() over Format() in this context is because the
result of CLng() is a number where Format() returns a string.
 
Hi Steve

Date Field values are numeric under the hood (I think) so I saw no needs to
convert to numeric and interpreted Jane's question as formatting rather than
converting.
 
Sure, Van, just wanted Jane to be aware of the difference. I admit in
practice it probably wouldn't make a lot of difference unless you are
dealing with dates before 17 May 1927, when we go from 4 digits to 5.

I'm so used to applying CLng() to dates, to cater to the American date
format problem :-)
 
Back
Top