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

Correct syntax for converting time to string field

Status
Not open for further replies.

Jackie

MIS
Feb 9, 2000
148
0
0
US

What is the correct syntax for
1. converting time() to string
2. showing the value in hhmm format
3. do not include the colon separator

The result should be 1223 for 12:23.

I use =Str(Time()) to get time converted to a string, but am having trouble getting the hours and minutes only without the colon.

When I set the format property to hhmm, the "mm" gets changed to "nn".

When I set the format property to short time, the entire time value is displayed including seconds and PM.

Thank you in advance.
 
You might try "Format(time(),"hhnn")".
 
The time separators are set by your computer. Go to start/settings/control panel/regional options/time.

If there is also a way to do this in VBA, I want to know also!

Judge Hopkins

"...like hunting skunks underwater...."
John Steinbeck, The Grapes of Wrath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top