A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

converting dates to sequential number



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2004, 06:18 PM
JaneCline
external usenet poster
 
Posts: n/a
Default 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  
Old June 4th, 2004, 06:51 PM
Gerald Stanley
external usenet poster
 
Posts: n/a
Default 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  
Old June 4th, 2004, 08:04 PM
Steve Schapel
external usenet poster
 
Posts: n/a
Default 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  
Old June 5th, 2004, 03:59 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default 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  
Old June 5th, 2004, 04:08 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default 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  
Old June 5th, 2004, 04:21 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default 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  
Old June 5th, 2004, 08:05 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.