Format now function

Alhousani

Registered User.
Local time
Tomorrow, 02:39
Joined
Jan 3, 2005
Messages
15
Greeting,

I have a database with feils contained date/time. Currently I used Now() function as a default value and I want the date to be stored as dd-mm-yy hh:mm which I use it in format but if I click on the feilds the date shows dd-mmm-yy hh:mm:ss. I want it to save as 20-11-08 10:12 even when I click on the feilds I want it to appear as I mentioned.
 
An important note to remember is that Date/Time fields DO NOT STORE A FORMAT. They store a date serial number that is the number of days past a base date of 12/30/1899 12:00 AM

So when you store the date value of:

11/21/2008 9:42:16 AM

Access will store it as a Number/Double at in "Raw" form will look like this:

39773.4043518519

...

Then ... when you click in the control to edit the value, the date shown will be in a format that is generated from the regional settings on your computer. You can change the Regional Settings of your computer, but that will not "fix" every one elses observations ...

So ... If you want to control/store the format of a date, then store the date/time in a TEXT field and when searching/manipulating/sorting data based on the date/time, you can use CDate() to coerce the TEXT date/time into a "real" date/time value ...

Another method is to show the date/time in an UNBOUND text box, then in the AfterUpdate of that text box control, update the underlying record with the date/time value ...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom