time and date??

tico78

Registered User.
Local time
Today, 07:45
Joined
Mar 10, 2003
Messages
14
I want to put the time and date on a form.. I put a unbound text and put this code for the timer:

Private Sub Form_Timer()
On Error GoTo err_form_timer
'set the ControlSource for the text box
Me![t_mytime] = Format(Now(), "hh:mm:ss")

exit_form_timer:
Exit Sub

err_form_timer:
'some error handling here
Resume exit_form_timer
End Sub
(t_mytime is the name of the text box for the timer)

1. the problem is that it displays the military time, and I want the other format (12 hour format) how can I change that?

2.How can I put the date (dd mm yyyy) in the form??
 
I add the following to the On Timer Event of the form when I want to show the Date and Time:

Me.txtTime = Format(Now(), "dd/mm/yyyy h:m:s")

Change txtTime to the name of your unbound textbox.

Also, set the Time Interval to 1000
 
Last edited:

Users who are viewing this thread

Back
Top Bottom