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

How to format a time value into a 24 hr one. 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
I want to convert a field's string content of "6:00" to "18:00"). Do I use the use the format() function? Will someone show me how to do this??

Thanks in advance.

Steve728
 
Use an update query.
Code:
UPDATE myTable SET myField = "18:00" WHERE myField = "6:00"


Randy
 
Great. I should have been more generally explicit. How do I turn whatever time is in the field to it's 24 hour equivalent?

Thanks again,

Steve728
 
You question was clear enough; Randy's having an off day. The general syntax is

Format(YourTimeField,"hh:nn")

To do the opposite would be

Format(YourTimeField,"hh:nn am/pm")



The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 




CAVEAT: The Format function returns a STRING rather than a DATE/TIME value.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Try

Cdate(Format(YourTimeField,"hh:nn")) to turn it from string to date format if you're using it as date criteria.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top