On 04/18/2013 03:13 AM, Dr.Ruud wrote:


If your box already is in that timezone, you can use localtime().

perl -Mstrict -we'
   my @dt = reverse +(localtime)[0..5];
   $dt[0] += 1900;  # year
   $dt[1] += 1;  # month
   printf qq{%s-%02d-%02d %02d:%02d:%02d\n}, @dt;
'
2013-04-18 09:09:22

i would think you would know about POSIX::strftime. much cleaner and more flexible than doing it all by hand. it is in core and the standard way to print timestamps in almost any format.

uri


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to