CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
AIX61 Perl5.8.8.120


New User

Aug 21, 2010, 5:03 PM

Post #1 of 2 (993 views)
AIX61 Perl5.8.8.120 Can't Post

I have the following code in my script which has been working on AIX5.3 but it started giving me wrong "hour" (localtime -5 hrs) when running on AIX61. Here is the code:

EPOCH_DATE=`date +%s`
perl -le ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime('${EPOCH_DATE}'); printf "%02d%02d%02d%02d%02d\n",$mon+1,$mday,$hour,$min,$year%100'

Appreciate any help.

Veteran / Moderator

Aug 21, 2010, 5:22 PM

Post #2 of 2 (990 views)
Re: [kuldip27] AIX61 Perl5.8.8.120 [In reply to] Can't Post

The first step is to verify that the server is set to the correct datetime, preferably via ntp.

Then, use the strftime function from the POSIX module.

use POSIX qw(strftime); 

print strftime("%m%d%H%M%y", localtime);


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives