One second later, the correct time zone is -0700 (PDT).

No, PST doesn't suddenly stop existing because the laws change the official local time to PDT.

One second after 2016-03-13 01:59:59-0800 is 2016-03-13 02:00:00-0800 aka 2016-03-13 03:00:00-0700 (aka 2016-03-13 10:00:00+0000 and so many others).

So sannag is right that they could fix the time (2016-03-13 03:00:00-0700), but that's only one of the options. Fixing the time zone (2016-03-13 02:00:00-0800) is another.

It's quite common to store all times using a specific offset. Normally, that offset is UTC+0000, but that is by no means a requirement. A local power plant used EST (UTC-0500) year round despite local time switching between EST (UTC-0500) and EDT (UTC-0400).

Using location-based time zone names (America/Los_Angeles) eliminates this issue.

Clearly not. The OP had the issue while using America/Los_Angeles.


In reply to Re^5: DateTime Invalid local time for date in time zone by ikegami
in thread DateTime Invalid local time for date in time zone by sannag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.