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!

Number to time format

Status
Not open for further replies.

mart1000

MIS
May 23, 2007
39
GB
I am using Crystal 8.5 I have times in would you beleive in number format eg 153810 which is 15 : 38 :10 , How do I make the conversion
 
Use a formula:

whileprintingrecords;
stringvar TheTime := totext({table.time},0,"");
ctime(left(TheTime ,2),mid(TheTime,3,2),mid(TheTime,5,2))

-k
 
whileprintingrecords;
stringvar TheTime := ToText ({JNJ_F0101_Audit_File_(A570101).Time Last Updated (AB57UPMT)},0,"");
ctime(left(TheTime ,2),mid(TheTime,3,2),mid(TheTime,5,2))

Thanks, I have put the above into my formula but get the error msg "Too many arguements have been given to this function"
Can anybody advise please?
 
Also Im not sure this would allways work anyway. I think I should read from the right surely? eg if I had the no 95021
then this needs to show 9:50:21 and I think if your method worked it would show 95:02:1
 
Try this formulae: {@disp_time}

whileprintingrecords
numbervar val1 := {table.time};
stringvar temp := totext(val1,0,"");
stringvar the_time := ReplicateString ('0',6 - len(temp) ) + temp;

numbervar hh := tonumber(left(the_time,2));
numbervar mm := tonumber(mid(the_time,3,2));
numbervar ss := tonumber(right(the_time,2));

Time (hh, mm, ss);
 
Sorry, it requires numerics, so use:

whileprintingrecords;
stringvar TheTime := ToText ({JNJ_F0101_Audit_File_(A570101).Time Last Updated (AB57UPMT)},0,"");
ctime(val(left(TheTime ,2)),val(mid(TheTime,3,2)),val(mid(TheTime,5,2)))

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top