Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting seconds to hh:mm:ss
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00113159
Message ID:
00113252
Views:
27
Ed,

The PAD() functions will directly do the work you are using str() and alltrim() for in your version.

>
>LPARAMETER nElapsedSecs
>LOCAL dRefPoint, cReturnString
>dRefPoint = DTOT(DATE() ) + nElapsedSecs
>cReturnString = PADL(ALLTRIM(STR(HOUR(dRefPoint),2)),2,'0') + ':' + ;
>                          PADL(ALLTRIM(STR(MINUTE(dRefPoint),2)),2,'0') + ':' + ;
>                          PADL(ALLTRIM(STR(SEC(dRefPoint),2)),2,'0')
>RETURN cReturnString
>
>
>You can get the number of days with TTOD(dRefPoint) - DATE(). You can speed it up slightly by using a date constant in place of DATE().
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform