gio001 has asked for the wisdom of the Perl Monks concerning the following question:
which is Fri Mar 18 17:27:46 2011 for which I would expect an output of the form:1300483666
this code returns:2011 03 18 05 21 1
This is the code I use :2011 03 18 05 17 1
I really hope someone can help and explain my error. Thanks!perl -lne '($j1,$j2,$hour,$mday,$mon,$year,$wday) = gmtime($_);$year = + $year + 1900;$mon++;printf("%4s %.2d %.2d %.2d %.2d %6s\n",$year,$mo +n,$mday,$wday,$hour,1);' < inputFile >outputFile
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl date conversion
by Fletch (Bishop) on Mar 23, 2011 at 18:22 UTC | |
|
Re: Perl date conversion
by toolic (Bishop) on Mar 23, 2011 at 17:24 UTC | |
by gio001 (Acolyte) on Mar 23, 2011 at 17:45 UTC | |
by gio001 (Acolyte) on Mar 23, 2011 at 17:58 UTC | |
by ikegami (Patriarch) on Mar 23, 2011 at 18:34 UTC |