03-15-2010 11:07 AM
Wanted to check and see if this is alredy done.
With time in UTC, and the users Time Zone, does anyone have a good function already created to see if its in DST. i know that its the second Sunday in March is forward, and First Sunday in November is back.
or maybe CVI has one built in I can't find. Either way, it wouldn't be hard to do but don't know a good way to figure out certain weekday of a month.
Solved! Go to Solution.
03-15-2010 12:21 PM
Check out the ANSI C functions time() and localtime() and the corresponding tm structure, which contains a flag int tm_isdst.
JR
03-15-2010 12:36 PM
I understand those functions, but I can't seem to figure out if a certain time in the past isDST. for example we are currently in DST but my test was from nonDST
time give me current time and if its DST
mktime - I tell it if its DST (which is opposite of what I want)
gmtime - Could figure out gmtime but their rules on DST are different than where my user might be.
So seems like I should create a progrma manually by figuring if its in the time frame.
03-16-2010 04:33 AM
According to Microsoft's help description for their mktime() function, you can fill in a tm structure for the date you wish to test, but setting the tm_isdst field to a negative value first. This will force the function to calculate the correct value for the field - in other words it will then tell you if DST was in effect for that date.
I'm not sure if this is standard ANSI behaviour for this function, but it should be easy enough for you to test it out.
JR
03-16-2010 08:59 AM