-> Dates are getting reversed <-

L

Linda

I have a table with 2 records, one field is date/time
field and is formatted like mm/dd/yyyy.
Cuurently I have the following dates 01/22/2004 and
09/22/2001.

When I assign the date values to dtstart
(this is variant) the dates get reversed, so 01/22/2004
becomes 22/01/2004 and 09/22/2004 becomes 22/09/2004

dtstart = CDate(Format(rstsplit!StartDate, "mm/dd/yyyy"))

However when use
dtstart = Format(rstsplit!StartDate, "mm/dd/yyyy")
then I noticed that dtstart becomes a string value.

Can anyone explain why this is happening? TIA
 
J

Jeff Boyce

Linda

Sounds like a "European" vs. "US" date formatting. What are your settings
for Windows?
 
A

Allen Browne

Open the Windows Control Panel | Regional Options | Date, and see how you
have Short Date defined.

CDate() interprets a string based on the assumption that it matches you
Windows date settings.

Format() generates a string output, as you said.

Date/Time fields are actually stored in Access as a fractional number, where
the whole number represents the date, and the fraction represents the part
of the day. Using this system, Access can present the date to you in the
format specified by your regional settings, and present the same date to a
person with different settings correctly on their system also.

For more information, see:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top