Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timecalc.prg
Message
 
À
23/01/2002 18:19:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00609326
Message ID:
00609625
Vues:
10
>Hi Again,
>
>Its working quite well. I am getting the difference between the time in seconds. If I read your reply right there is a easier way to turn seconds into hours and minutes? If so, could you point me in the right direction? Or is it just as easy to get hours, str(int(seconds/3600)) and concatenate that with minutes, STR(INT((seconds%3600)/60))?
>
Chris,

The only problem in the above will be with hours or minutes less than 10. If you were to concatenate the hours and minutes without checking for that condition, you might end up with something like 8:9, which I don't think is what you're after. How's this?:
lnhours = SET("HOURS")
SET HOURS TO 24
* lnseconds is the difference returned by the subtraction
* of one date/time from another
* the date value shown below is of no consequence
* and can be any date.
lctime = TTOC(DATETIME(2002, 1, 24) + lnseconds, 2)
* Restore the orginal setting of hours
SET HOURS TO lnhours
In this example, this will return "10:35:00". If the seconds aren't needed simply take the first five character using the LEFT() function.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform