How do I Seperate the Time() function into hh:mm:ss

gold007eye

Registered User.
Local time
Today, 03:04
Joined
May 11, 2005
Messages
260
Here is what I am trying to do with no luck.

I have 3 text box fields

Hour
Minute
Second

I need each field's default value to correlate based on the current time when the forms is opened / refreshed. Time()

I have been trying to use =Left(Time(),2) for the Hour box, it works somewhat. It shows 1: but what I would rather is have it show 01

I haven't been able to get the Minute box to populate trying to use =Mid(Time(),4 if the current time is 1:46PM it the minute box is reading 6:

and I'm not sure how to get the seconds to show up.

Basically I need to know how to seperate hh:mm:ss into hh mm ss (in 3 separate boxes based on the current time; and I also would like to have a "0" used for hours/minutes/seconds between 1-9 (so 01, 02, 03, 04, etc.) along with being able to get rid of the ":" so that just the numbers will be extracted from the current time and shown in the 3 text boxes.

I have attached the Tool I am trying to do this for so hopefully that will help better explain it.

Please help :)
Thanks.
 

Attachments

Hi -

? format(time(), "hh")
13
? format(time(), "nn")
12
? format(time(), "ss")
16
 
Thanks works perfectly :)

But is there anyway to make the "HH" show in 12 Hour format instead of 24 Hour format? so 2PM would show as 02 or 2 instead of 14.
 

Users who are viewing this thread

Back
Top Bottom