Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Day light savings issue
Message
From
08/11/2007 01:56:17
 
 
To
08/11/2007 01:16:14
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01267255
Message ID:
01267523
Views:
17
>>>All,
>>>
>>>A client called about an incorrect calculation of the time (hrs) between two events. I was calculating the time by using ROUND(DateTime2 - DateTime1)/3600,0). However this does not take into account change of time because of daylight savings.
>>>
>>>I'm aware that Windows does store the date and time somewhere on which the daylight saving time change happens. It needs to pick it up from the regional settings as the software is running in many different countries, with and without daylight savings.
>>>
>>>Is there an easy way of calcutating the number of hours between two events and taking day light savings into account.
>>
>>Suppose datetime1 has been stored in summertime and datetime2 12 REAL hours later in wintertime. Are you implying that your calculation shows 12 hours difference?
>
>No, I'm implying that the calculation shows 35 hours while it should have been 36 hrs.

I think Dragan has the right idea, if you convert your inputs to UTC everything should be OK.

On a quick search I don't see any VFP functions that would help with that, nor anything in Downloads etc. here. Maybe some Win32API functions and some elbow grease could do it: http://news2news.com/vfp/?group=76

On the Wiki: http://fox.wikis.com/wc.dll?Wiki~XMLDateTime~VFP
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform