in reply to Perl date conversion

I can not reproduce your results. Are you sure your input file is what you think it is?
echo 1300483666 | perl -lne '($j1,$j2,$hour,$mday,$mon,$year,$wday) = +gmtime($_);$year = $year + 1900;$mon++;printf("%4s %.2d %.2d %.2d %.2 +d %6s\n",$year,$mon,$mday,$wday,$hour,1);' 2011 03 18 05 21 1

Replies are listed 'Best First'.
Re^2: Perl date conversion
by gio001 (Acolyte) on Mar 23, 2011 at 17:45 UTC
    My message is incorrect, I want to have this output from an input of 1300483666: 2011 03 18 05 17      1 and instead the code returns: 2011 03 18 05 21      1 Sorry for the mistake. Can you help? I suppose I can make the gmtime($_)be like gmtime($_-14400) but I thought there might be a cleaner way to resolve the date in input to my local time (EST or EDT whatever it happens to be). Can I do without the gmtime all together? Hope you can help. Thanks
      I replaced gmtime with localtime and it seems to work properly. Thanks Any advice anyway?
        That's correct.