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

convert string to time

Status
Not open for further replies.

ericb123

MIS
Mar 3, 2008
55
US
I cannot seem to get this correct: Using CR11, I have a string which is military time, formatted as HHMMSS:

135819

How can I convert this to a time, then convert it from military time to 12hour time? I've tried the Ctime function, and the Istime func, but it doesn't work.

The IsTime func. returns true when the time happens to fall within the 1-12 hours, then false for anything above 12.

Any help is greatly appreciated, thanks!
 
Use a formula like this:

stringvar x := {table.string};
time(val(left(x,2)),val(mid(x,3,2)),val(right(x,2)))

You can then format this however you like.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top