If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
converting dates to sequential number
I need to convert a date field to the sequential number
the computer assigns to it. What is that function? |
#2
|
|||
|
|||
converting dates to sequential number
Take a look at the DateSerial function.
Hope This Helps Gerald Stanley MCSD -----Original Message----- I need to convert a date field to the sequential number the computer assigns to it. What is that function? . |
#3
|
|||
|
|||
converting dates to sequential number
Jane,
Try this... CLng([YourDateField]) -- Steve Schapel, Microsoft Access MVP JaneCline wrote: I need to convert a date field to the sequential number the computer assigns to it. What is that function? |
#4
|
|||
|
|||
converting dates to sequential number
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. -- HTH Van T. Dinh MVP (Access) "JaneCline" wrote in message ... I need to convert a date field to the sequential number the computer assigns to it. What is that function? |
#5
|
|||
|
|||
converting dates to sequential number
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. -- Steve Schapel, Microsoft Access MVP Van T. Dinh wrote: 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. -- HTH Van T. Dinh MVP (Access) |
#6
|
|||
|
|||
converting dates to sequential number
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. -- Cheers Van T. Dinh MVP (Access) "Steve Schapel" wrote in message ... 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. -- Steve Schapel, Microsoft Access MVP |
#7
|
|||
|
|||
converting dates to sequential number
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 :-) -- Steve Schapel, Microsoft Access MVP Van T. Dinh wrote: 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. -- Cheers Van T. Dinh MVP (Access) |
Thread Tools | |
Display Modes | |
|
|