Hi marek,

This piece of code seems to work fine on my linux box, except for item: 391263207 => "Sonntag, 26.05.2013 - 13:13:27". Could you run it on more data?

#!/usr/bin/perl use warnings; use strict; use Date::Calc qw(Day_of_Week Day_of_Week_to_Text); use Time::Local; my %date_pairs = ( 391263207 => "Sonntag, 26.05.2013 - 13:13:27", 410000659 => "Sonntag, 29.12.2013 - 10:04:19", 410891318 => "Mittwoch, 08.01.2014 - 17:28:38", 412528640 => "Montag, 27.01.2014 - 16:17:20", 413028709 => "Sonntag, 02.02.2014 - 11:11:49", 414241970 => "Sonntag, 16.02.2014 - 12:12:50", 433494560 => "Samstag, 27.09.2014 - 09:09:20" ); $ENV{TZ} = 'Europe/Berlin'; # sec,min,hours,day,month,year my $epoch = timegm(0, 0, 0, 1, 0, 70); my $macep = timegm(0, 0, 0, 1, 0, 101); print "$epoch -- $macep\n"; foreach my $key ( sort keys %date_pairs ) { # 0 1 2 3 4 5 6 7 8 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localti +me($key+$macep); $mon++; $year += 1900; my $dstr = Day_of_Week_to_Text(Day_of_Week($year, $mon, $mday), 3) +; my $datestr = sprintf("%-8s %02d.%02d.%02d %02d:%02d:%02d %d", $ds +tr, $mday, $mon, $year, $hour, $min, $sec, $isdst); print "$key - $date_pairs{$key} -- $datestr\n"; }
Output:
0 -- 978307200 391263207 - Sonntag, 26.05.2013 - 13:13:27 -- Sonntag 26.05.2013 14: +13:27 1 410000659 - Sonntag, 29.12.2013 - 10:04:19 -- Sonntag 29.12.2013 10: +04:19 0 410891318 - Mittwoch, 08.01.2014 - 17:28:38 -- Mittwoch 08.01.2014 17: +28:38 0 412528640 - Montag, 27.01.2014 - 16:17:20 -- Montag 27.01.2014 16: +17:20 0 413028709 - Sonntag, 02.02.2014 - 11:11:49 -- Sonntag 02.02.2014 11: +11:49 0 414241970 - Sonntag, 16.02.2014 - 12:12:50 -- Sonntag 16.02.2014 12: +12:50 0 433494560 - Samstag, 27.09.2014 - 09:09:20 -- Samstag 27.09.2014 09: +09:20 1
Regards

In reply to Re: Date::Calc and and daylight savings time by pme
in thread Date::Calc and and daylight savings time by marek1703

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.