Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date reversal problem

Status
Not open for further replies.

irishandy

Programmer
Nov 18, 2003
39
IE
Hi.

I'm having a problem with a date/time field. For some reason it is reversing the dates when they are entered, for example if you enter the date 24/04/2002, it stores it as 02/04/2024. I simply cannot work out why this is happening. Fixing it isn't a problem per se as I can just create another field and populate it manually. It's annoying and laborious but it will work. However I would still like to know what the cause was in the first place in order to avoid a repeat of the problem. Would anyone have any ideas?
 
- update to the above -

I had thought that creating a new field would do the trick but it doesn't. The same thing happens. Now I'm really confused...
 
check your window settings to ensure you haven't specified ymd format.

[pc]

Graham
 
No, that's not the problem. I've double checked to make sure - it's set to dd/mm/yyyy in Regional Settings.
 
The problem occurs both when entering via a form or directly into the table.
 
So, if you open the table and type in a new record 24/04/2002 and press enter, will it instantly change to 02/04/2024? even if the regional settings was yyyy/mm/dd it will be stored as 2002/04/24...
 
I was about to reply saying that yes, that is exactly what happens, except that I decided to change the settings to something else (yyyy/mm/dd as you suggested) and when I did so the problem disappeared. I then changed the settings back and the problem still seems to be fixed.

The thing is I still don't know why it occurred in the first place...

 
I have no idea but if it working now.....;-)

take care
nicsin
 
Dates are stored as fractional numbers. How you see it is how you format it for display. The default display is what you are seeing. The windows regional settings may have an impact on the default format of the date but the date is still stored as a number. The integer part of the number is the number of days since a starting point (I believe 12/31/1899 for Access and 1/1/1900 for sql server). The fractional part is the time of day as 100th. Check out the various display formatting TimeSerial, DateSerial, Format, etc....

If you want dd/mm/yy then
Format(yourdate("dd/mm/yy") when you display it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top