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

Display Military time and no date. 1

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
US
On my form I have a I have a Time in Box and a Time out Box. When I MouseDown on either box
I would like to display the current time in military time. I do not want the date but just the time. I have tried in
vain to figure this out. Please advise.
 
Code:
Me.Text0 = Format(Now, "Hh:Nn")

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks ZmrAbdulla:

the time now is showing as 9:20. Do you know how I can
make it show as military time "0920"?
 
It should show like "09:20"
removing the ":" will show it like "0920"

Format(Now, "HhNn")

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
See titled "User-Defined Date/Time Formats (Format Function)" in the help file for more details.


________________________________________________________
Zameer Abdulla
Help to find Missing people
 
I have searched and searched. The time is now showing as
920 but will not show as 0920! Anymore suggestions out
there???
 
Format(Now(), "hhnn")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I dont know of a good way to do it - but i vaguely remember doing that for a punching system program once upon a time

dim dtmMilitary
If hour(time) < 10 then
dtmMilitary = "0" & Format(Now(), "hhnn")
else
dtmMilitary = Format(Now(), "hhnn")
End if

test that to see if you are getting the results you want

-I know, talk about a work around ;)

hth
sg284
 
Not sure why it behaves like.. try
Code:
Me.Text0 = Replace(Format(Now(), "Short time"), ":", "")

________________________________________________________
Zameer Abdulla
Help to find Missing people
 

PHV's code is correct!

Format(Now(), "hhnn")

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top