Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning days, hours and minutes
Message
 
 
À
07/03/2001 00:42:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00482583
Message ID:
00482883
Vues:
32
>Hi, everybody.
>
>Does anybody have some function to do the following example?
>
>? BringDaysHoursMinutes({^2001-03-15 10:00:00AM})
>
>that returns
>
>It's remaining: 5 day, 6 hours and 24 minutes to the dead line.



There is a template of the function that will calculate Days, Hours, Minutes and Seconds. I did only light testing and didn't find any problems. You will have to format result returned by it to your liking.
? BringDaysHoursMinutes({^2001-03-15 10:00:00AM})

RETURN

Function BringDaysHoursMinutes(ttDeadLine)
LOCAL ltDateTime

ltDateTime = Datetime()

*ltDateTime = {^2001-03-14 11:20:00AM}


* Get remaining time in seconds
lnRemSec = Int(ttDeadLine - ltDatetime)

* Get Days, Hours, Minutes and Seconds

lnDays = Int(lnRemSec / 86400)

lnHours = Int( (lnRemSec - (lnDays * 86400)) / 3600)

lnMinutes = Int( (lnRemSec - (lnDays * 86400) - (lnHours*3600)) / 60)

lnSeconds = Mod( (lnRemSec - (lnDays * 86400) - (lnHours*3600)), 60)


RETURN  Transform(lnDays) + ", " + ;
		Transform(lnHours) + ", " + ;
		Transform(lnMinutes) + ", " + ;
		Transform(lnSeconds)
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform