ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
Is this a bug in localtime
by Pankaj Singh other posts by this author
Aug 29 2008 3:37AM messages near this date
[perl #58428] Unicode::UCD::charinfo() does not work on 21 Han codepoints | Re: Is this a bug in localtime
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 Per
sistent 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 er
ror, please notify the sender and delete all copies of this message. Persistent Systems Ltd.
 does not accept any liability for virus infected mails.
Thread:
Pankaj Singh
Abigail

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved