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

Date Time to Time Text - 24 hr format 1

Status
Not open for further replies.

reportdr

Technical User
Apr 11, 2006
10
Hello

I am working with Crystal 8.0 on a Windows XP/SP2 computer accessing an ODBC database.

I am creating a report for a 3rd party vendor that must be in fixed length fields. I have the fixed length part figured out for most of the report but I'm having difficulties in getting a date/time field to show up as time only in the 24 hour clock format.

My current formula is:

numbervar requiredlength:=5;
numbervar currentlength:=Length(Trim(ToText({DB.TRIAGEDATE},"hh:mm")));

if currentlength<requiredlength then
Trim(ToText({DB.TRIAGEDATE},"hh:mm"))+replicatestring(" ",requiredlength-Length(Trim(ToText({DB.TRIAGEDATE},"hh:mm"))) ) else
if currentlength>=requiredlength then
left(ToText({DB.TRIAGEDATE},"hh:mm"),requiredlength)

Tbis works but doesn't show the time in 24 hour clock format. Thanks in advance.

S.
 
Try changing the lowercase "hh:mm" to "HH:mm". I think this will change the result to 24-hour time.

-LB
 
You are the absolute greatest!!! A big huge star to you! (as you can tell from my reaction it worked!!)

I also want to thank you for your efforts on this site - you must visit thie site daily, ALWAYS answers questions and are very polite and positive while doing so. You never make people feel stupid and for that I am grateful!

Thanks again LB!

S.
 
Thank you for the nice comments. Glad it worked for you.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top