{"id":11243,"date":"2011-03-11T07:00:00","date_gmt":"2011-03-11T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/03\/11\/why-does-my-time_zone_information-have-the-wrong-dst-cutover-date\/"},"modified":"2011-03-11T07:00:00","modified_gmt":"2011-03-11T07:00:00","slug":"why-does-my-time_zone_information-have-the-wrong-dst-cutover-date","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110311-00\/?p=11243\/","title":{"rendered":"Why does my TIME_ZONE_INFORMATION have the wrong DST cutover date?"},"content":{"rendered":"<p>Public Service Announcement: Daylight Saving Time begins in most parts of the United States this weekend. <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/11\/05\/10086404.aspx#10086843\"> Other parts of the world may change on a different day from the United States<\/a>.\n A customer reported that they were getting incorrect values from the <code>GetTimeZoneInformationForYear<\/code> function.<\/p>\n<blockquote class=\"q\"><p> I have a program that calls <code>GetTimeZoneInformationForYear<\/code>, and it looks like it&#8217;s returning incorrect DST transition dates. For example, <code>GetTimeZoneInformationForYear(2010, NULL, &amp;tzi)<\/code> is returning March 2nd as the tzi.DaylightDate value, instead of the Expected March 14th date. The current time zone is Pacific Time. <\/p><\/blockquote>\n<p> The value returned by <code>GetTimeZoneInformationForYear<\/code> (and <code>GetTimeZoneInformation<\/code>) is correct; you&#8217;re just reading it wrong.\n As called out in the documentation for <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms725481.aspx\"> the <code>TIME_ZONE_INFORMATION<\/code> structure<\/a>, the <code>wDay<\/code> field in the <code>StandardDate<\/code> and <code>DaylightDate<\/code> changes meaning depending on whether the <code>wYear<\/code> is zero or nonzero.\n If the <code>wYear<\/code> is nonzero, then the <code>wDay<\/code> has its usual meaning.\n But if the <code>wYear<\/code> is zero (and it is for most time zones), then the <code>wDay<\/code> encodes the <i>week number<\/i> of the cutover rather than the day number.<\/p>\n<p> In other words, that 2 does not mean &#8220;March 2nd&#8221;. It means &#8220;the second week in March&#8221;. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Public Service Announcement: Daylight Saving Time begins in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer reported that they were getting incorrect values from the GetTimeZoneInformationForYear function. I have a program that calls GetTimeZoneInformationForYear, and it looks like [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25,108],"class_list":["post-11243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code","tag-time"],"acf":[],"blog_post_summary":"<p>Public Service Announcement: Daylight Saving Time begins in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer reported that they were getting incorrect values from the GetTimeZoneInformationForYear function. I have a program that calls GetTimeZoneInformationForYear, and it looks like [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=11243"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11243\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=11243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=11243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=11243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}