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

Convert a decimal value to a time value

Status
Not open for further replies.

jonmohr

IS-IT--Management
Sep 15, 2004
118
US
I need to be able to create a decimal to time.

For example:

1.5 minutes to 1:30

Thanks in advance!!!
 
Your display is NOT a time, it is a string of minutes and seconds, a time has hours.

I would suggest converting it to seconds:

Try:

whileprintingrecords;
numbervar DecTime:={table.field};
numberVar dur := Totalsecs:=(DecTime*60);
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");
hhmmss

-k

 
Sorry, (Irealized that my copty paste screwed up:

whileprintingrecords;
numbervar DecTime:=1.5;
numbervar Totalsecs:=(DecTime*60);
numberVar dur := Totalsecs
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");

hhmmss

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top