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

Time Format 1

Status
Not open for further replies.

mrkshpntf

MIS
Apr 19, 2007
92
US


I have a form which needs to display the current date and time in the respective (date and time) fields/text boxes on the form, when it is opened.

I have set the default value of the date field/text box to 'Date()' which works fine.

I need the time field to display the current time in 4-digit numbers, for example, 9:32 AM as 0932 or 5:37 PM as 1737.

Please help

Thanks,
mrkshpntf.
 
How are ya mrkshpntf . . .

Use Now() instead of Date to return the date & time. Date only returns the date . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
mrkshpntf . . .

For the format try [blue]HhNn[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 

TheAceMan1,

Thanks for your response.

The issue I have is that the date and time fields are separate in the underlying table and need to be recorded individually.

The Date part works fine. The time however needs to be formatted in the 4-digit format due to requirement constraints.

When I enter HhNn in the format property of the time text box, Access converts it to hhnn and displays the time in "hh:mm:ss AM" format.

Thanks for your help,
mrkshpntf.
 

TheAceMan1,

I figured it out!

All I had to do was enter this: =Format(Now(),"hhnn")
in the 'default value' property of the Time text box.

It works as needed.

Thanks for your help,
mrkshpntf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top