I've managed to install the DateTime module but I'm still getting incorrect values returned as it moves through the Daylight Saving Time change.

I've added the following code:
my $dt = DateTime->new ( year => $obs_year, month => $obs_month, day => $obs_day, hour => $obs_hour, minute => $obs_minute, time_zone => 'Europe/London', ); $dt->set_time_zone( 'UTC' );
The following is output:

LOCAL | UTC
2014/10/26 00:59 | 2014/10/25 23:59 <- Correct
2014/10/26 01:00 | 2014/10/26 01:00 <- Incorrect, should be 00:00

UTC is also actually repeating 01:00 - 01:59 so after the Daylight Saving Change it is correct again it's just the transition it appears to go wrong.

The UTC datetime is still being moved on by 1hr - this should stay the same enabling the Local time to catch-up.

Have I coded this correctly?

Really appreciate your help on this - Thanks.

In reply to Re^3: Converting local time to utc time by ureco
in thread Converting local time to utc time by ureco

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.