One of my outputs from a study is the trade date and time e.g. for entry or exit. I export this value to Excel which automatically converts it to correct format (yy-mm-dd hh:ss). I derive this value in the efs as follows:
myTime = (rawtime(0) + 3600 - 60) / 86400 + 25569;
// +3600 to adjust for one hour time change for DST.
// - 60 TO adjust for one minute
// /86400 to convert to days
// +25569 to add 70 years to make the date compatible with Excel
This worked fine until October 29, 2006. The +3600 adjustment is no longer required when the clocks went back one hour. While I can adjust the code to test if the date falls before or after October 29, 2006 this would be a temporary solution as I would have to rewrite the code again in Spring of 2007.
Does anyone have a permanent solution for a code that would adjust for one hour automatically for DST? Any help would be appreciated.
Hamid.
myTime = (rawtime(0) + 3600 - 60) / 86400 + 25569;
// +3600 to adjust for one hour time change for DST.
// - 60 TO adjust for one minute
// /86400 to convert to days
// +25569 to add 70 years to make the date compatible with Excel
This worked fine until October 29, 2006. The +3600 adjustment is no longer required when the clocks went back one hour. While I can adjust the code to test if the date falls before or after October 29, 2006 this would be a temporary solution as I would have to rewrite the code again in Spring of 2007.
Does anyone have a permanent solution for a code that would adjust for one hour automatically for DST? Any help would be appreciated.
Hamid.
Comment