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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date converts to 31/12/1899

Status
Not open for further replies.

AndWy

Programmer
Mar 13, 2001
13
0
0
GB
okay, what about this one then....

I have a data entry form on which one of the fields is a date defaulting to todays date, ie date(). The form adds the appropriate record fine on my PC but when the application is packaged into runtime & loaded onto a target PC the date converts itself to 31/12/1899???. I think I may have a missing reference but I don't know which one. Any ideas anyone ????????????
 
Unless someone else knows better, I would try applying a Format function to that date. Like...

= Format(Date(), "mm/dd/yyyy")

OR, use the Now() function instead. Try...

= Format(Now(), "mm/dd/yyyy")

Hope it helps,
Gary
gwinn7
 
Is this a 2000 or 97 Db? If 2000, I'm wondering if it has something to do with the "use four digit formatting" option?
Which references do you have and what's their order? Is it possible you're forcing a format on to a computer that uses a different windows date format? i.e. YYYY/MM/DD or other?
I do remember a similar issue once but cannot for the life of me remember how it was resolved.... Gord
ghubbell@total.net
 
It's an Access 2000 database and I've set the date format
to dd/mm/yyyy and the default to Date() in the relevant table.

The references I have included are 1. Visual Basic for Applications, 2. Microsoft Access 9.0 Object Library &
3. Microsoft DAO 3.6 Object Library.

I will try the references in a different order although I didn't know it made a difference and the Now() function instead of Date(). Thanks for responding both of you.
 
I suspect somehow the stored value for your date is being set to CDate(1.0).

The internal representation of a date/time value is a floating point number where the integer part corresponds to the date and the fractional part is the time represented as a fraction of a date. A value of 0.0 corresponds to midnight on the date December 30, 1899. Your value is coming out December 31, 1899, which is exactly 1.0 in internal representation.

Are you doing any arithmetic with this date? Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top