C# Daylight saving DateTime switch -
i have events triggered whenever daylight switches happen.
i when spring/fall switches going happen using
timezone.currenttimezone.getdaylightchanges(year)
this returns me 2 datetimes: 1. start datetime spring cutover 3. end datetime fall cutover.
the spring forward works fine.
but fall 1 end time 2.00 cst. when subtract second 1.59.59 cst. event gets fired hour later. need set trigger 1.59.59 cdt. how construct datetime?
you looking set 1 second before start of time change. convert utc, subtract delta , second.
datetime fall; //set 2:00 cst daylighttime time; //filled getdaylightchanges() call. datetime falladjusted = fall.touniversaltime().subtract(time.delta).addseconds(-1);
Comments
Post a Comment