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:
01360240
Vues:
8
>>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
>
Thank you. I didn't think of converting to seconds and calculating the difference in seconds and then converting to minutes. I appreciate your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform