Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Math with dates/times ----- Novice
Message
De
02/04/1998 10:24:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/04/1998 08:21:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00088775
Message ID:
00088947
Vues:
34
>>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 certainly looks a lot cleaner (and shorter!) than anything I was considering. Thanks much, I'll try it out (and keep it around for *next* time!)
Well Paul,
Adding further to datetime arithmetic another way of doing it :
nMinutes = 15
dtNMinutesLater = dtot(date())+seconds()+nMinutes*60
nHours = hour(dtNMinutesLater)
nMinute = minute(dtNMinutesLater)
*nSecond = sec(dtNMinutesLater)
RETURN PADL(LTRIM(STR(nHours)),2,'0')+':'+PADL(LTRIM(STR(nMins)),2,'0')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform