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

Space Before AM/PM Designator

Status
Not open for further replies.

M4XiMuS

Programmer
Sep 1, 2009
7
US
I've searched all over the web as well as Tek-Tips for an answer to my dilemma to no avail. Hoping the community can come to my aid on this one! I have a string time field (for example - 12.34.56) that I converted to a time/date field using CTime function in formula @Start Time. As a result, it gives the time displayed in the following format:

12:34:56PM

I am trying to display the time so there is a space between the time and the AM/PM designator:

12:34:56 PM

I have tried using the format field options, but I fear as though my only option is to create a formula to accomplish my goal... and I'm not sure where to start in this case. Should I be incorporating AMPMafter somewhere in my formula?

Please help!

Regards,
-M4X

 
Be advised, the AM/PM designator needs to be capitalized. That is caveat I failed to include in my original post. Thus why none of the pre-programmed time/date designators will work for my needs.

Using CR2008.
 
This works, provided you don't mind the result being text:

left(totext({@TimeFormula}),len(totext({@TimeFormula}))-2) + " " + right(totext({@TimeFormula}),2)

 
Brian, I had a suspicion I'd have to convert the field back to text. The solution works great for my needs, many thanks!

-M4X
 
Or you should be able to use:

totext({@yourtimeformula},"HH:mm:ss tt")

//"HH" for military time, "hh" for regular time

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top