Front page | perl.perl5.porters |
Postings from August 2008
Is this a bug in localtime
Thread Next
From:
Pankaj Singh
Date:
August 29, 2008 03:36
Subject:
Is this a bug in localtime
Message ID:
1220005953.3374.20.camel@localhost.localdomain
Hi All,
I was trying to form timeStamp from localtime function in perl.
Perl version : v5.8.8 built for i386-linux-thread-multi
Output of date command
--------------------------------------
Fri Aug 29 15:56:14 IST 2008
The code I wrote in perl
------------------------------------
my ($sec, $min, $hour, $day, $month, $year ) = ( localtime ) [ 0, 1, 2,
3, 4, 5 ];
print "$year $month $day $hour $min \n";
printf("%04d-%02d-%02d %02d:%02d\n",$year+1900,$month,$day,$hour, $min);
print "\n";
@timeData = localtime(time);
print join(' ', @timeData);
The output was
----------------------
108 7 29 15 53
2008-07-29 15:53
10 53 15 29 7 108 5 241 0
But i was expecting
Something like
2008-08-29 15:53
Thanks,
Pankaj
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
Thread Next
-
Is this a bug in localtime
by Pankaj Singh