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

Date/Time field formatting

Status
Not open for further replies.

straybullet

IS-IT--Management
Jun 5, 2003
593
US
Have a date/time field being used to produce a unique Work Order number (based on creation date/time) format is set to yyyymmddhhnn

ex:200602151413
indicates that the WO was created 2/15/2006 at 2:15 pm
(2006 02 15 1413)

However, the following occurs:

20060217853 (2/17/2006 at 8:53 am) 2006 02 17 853

Is there a way to force the time to 4 digits as in 200602170853?

Let them hate - so long as they fear... Lucius Accius
 
When I use Format(now(),"yyyymmddhhnnss") I get 20060217084030.

If the field is actually a date/time field, you are always storing a value like 38765.363275463 .


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
The format is set in the field properties in the table. It is a true Date/Time field. Should I remove the formatting from the field properties and have it on the form instead?

Let them hate - so long as they fear... Lucius Accius
 
It doesn't make any difference what the format is when storing the value. The format is for display purposes only. I usually only set the format in places where a user will see the value such as in report or form controls.

As I stated earlier, if the field is a date field, it will not be storing the value 20060217084030. That value would be billions of years into the future (I think) since today is store as about 38766.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top