Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Math with dates/times ----- Novice
Message
From
02/04/1998 10:24:52
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/04/1998 08:21:45
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00088775
Message ID:
00088947
Views:
30
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform