using perl, how to print current Date and Time Of any specified TimeZone

Posted by dexter on Stack Overflow See other posts from Stack Overflow or by dexter
Published on 2010-03-23T06:26:03Z Indexed on 2010/03/23 6:33 UTC
Read the original article Hit count: 147

Filed under:
|
|

i have done like:

my($sec,$min,$hour,$day,$month,$yr19,@rest)= localtime(time);
print  "##########################" ;
print  "\nDate:\t$day-".++$month. "-".($yr19+1900). "\n";
print  "Time:\t".sprintf("%02d",$hour). ":".sprintf("%02d",$min). ":".sprintf("%02d",$sec)."\n";

it gives me wrong $day , $min and $sec

my timezone is IST,

is there any alternative to this ?

© Stack Overflow or respective owner

Related posts about perl

Related posts about timestamp