Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting seconds to HH:MM:SS
Message
De
29/10/2008 21:16:20
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01358171
Message ID:
01358229
Vues:
15
Even shorter with an IIF:
*****************************************
* stohms2
******************************************
PARAMETERS tiSeconds
LOCAL seconds,hrs,leftover,mins,secs,lcHMS
*-----------------------------------------*
* Testing
*-----------------------------------------*
IF PCOUNT()=0
	seconds=960
ELSE
	seconds=IIF(VARTYPE(tiSeconds)=[C], VAL(tiSeconds), tiSeconds) 
ENDIF 

hrs = seconds / 3600
leftover = seconds % 3600
mins = leftover / 60
secs = leftover % 60

lcHMS=PADL(ALLTRIM(STR(hrs)),2,'0')+[:]+PADL(ALLTRIM(STR(Mins)),2,'0')+[:]+PADL(ALLTRIM(STR(secs)),2,'0')

return(lcHMS)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform