Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Difference between two time stamps
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01360224
Message ID:
01360231
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
>What is the simplest (or just simple) way of calculating time difference in minutes? For example,
>
>
>*-- Store current Hours and Minutes portion of time
>nTime1 = substr(time(),1,5)
>*-- Store another time on Hours and Minutes
>nTime2 = substr(time(),1,5)
>
>
>Given that both time() reading were done in the same day, what is the difference between nTime2 and nTime1
>in minutes? (Note that I cannot use the Seconds() function)
>
>Thank you in advance for any help.
nTime1  = substr(time(),1,5)

*** Another time
nTime2 = substr(time(),1,5)
ltTime1 = DTOT(DATE())+VAL(LEFT(nTime1,2))*3600 + VAL(RIGHT(nTime1,2))*60
IF nTime1 > nTime2
   ltTime2 = DTOT(DATE()+1)+VAL(LEFT(nTime2,2))*3600 + VAL(RIGHT(nTime2,2))*60
ELSE
   ltTime2 = DTOT(DATE()+1)+VAL(LEFT(nTime2,2))*3600 + VAL(RIGHT(nTime2,2))*60
ENDIF
? ltTime2 - ltTime1 && Result in seconds
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform