Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Math with dates/times ----- Novice
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00088775
Message ID:
00088824
Vues:
27
>Is there a convenient way to do arithmetic with dates and times in
>VFP? To be specific, I am continually updating data in a grid and
>would like to notify the user of the time of the *next* update (say,
>15 minutes after the previous one).
>
>TIA
>Paul MacDonald

Paul,
I have just done the following calculation - some way to spend a vacation, eh? If you create a method or call a function to do the following...
---
nSeconds=INT(SECONDS()+(nn*60)) && nn being the number of minutes.
nHours=INT(nSeconds/3600)
nMins=INT((nSeconds-(nHours*3600))/60)
IF nHours>23
nHours=0
ENDIF
RETURN PADL(LTRIM(STR(nHours)),2,'0')+':'+PADL(LTRIM(STR(nMins)),2,'0')
---
This will return a string as "09:10" or "23:48" - I've just tested this in VFP5 (it has just hit midnight here and it went correctly from 23:59 to 00:00. If you want to do the date also, just put dNextDate=DATE() at top and in the IF nHours>23 bit, put dNextDate=DATE()+1. Regards,
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform