Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Time
Message
De
31/10/2001 06:58:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
30/10/2001 18:13:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Time
Divers
Thread ID:
00575377
Message ID:
00575530
Vues:
24
>If I have a value of 72600, which represents the number of seconds elapsed since midnight, which also happens to be 08:10 pm, how do I convert that into a string that says simply 08:10 pm? Getting the hours is easy, it's the minutes I'm having a problem with. I think I'm going brain dead.

The other replies basically answered your question, but perhaps you want to know how to solve the math involved, since it can be used in a variety of situations (for instance, converting a monetary amount into available bills/coins).
TotalSeconds = 72600
Hours = int(TotalSeconds / 3600)
SecondsLeft = TotalSeconds - lnHours * 3600
* or: SecondsLeft = TotalSeconds % 3600
Minutes = int(SecondsLeft / 60)
Seconds = SecondsLeft - 60 * Minutes && or SecondsLeft % 60

* Output may be something like this:
? padl(Hours, 2, "0") + ":" + padl(Minutes, 2, "0") + ":" + padl(Seconds, 2, "0")
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform