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!

Time to Text? CR9.0

Status
Not open for further replies.

Digitalcandy

IS-IT--Management
May 15, 2003
230
US
How do I convert a Time field to a text field? For example, I need the text field to disply like 3:30 pm.

So far I have;


ToText({@TimeField}, 'h:m')


But all I get with the code above is 3:30
 
Use this as your second argument for the ToText function:
"h:mm tt"

-dave
 
Thanks, that worked, but if I'm being picky, the "AM/PM" portion is in caps. Any way to make it lower case?
 
Wrap the whole thing in the LCase or LowerCase function:

LCase(ToText({@TimeField},"h:mm tt"))

-dave
 
Dear digitalcandy,

If this is an actual time field, you could simply right click on the field, select format field and format it to display as desired.

In addition, if this is what you want the default to be whenever you insert a field of type time into your report ... go to the File Options and select the Fields tab, click on the Time button and customize the field to display as desired, now whenever you insert a time field it will have your format already applied without having to use totext ...

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top