gsparx has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks,
I am having an issue with pulling server time information from a server, and my own computer in fact. I am running perl inside of a Windows Citrus Perl environment, but I see a similar issue in Ubuntu as well.
I am pulling the time/date from a server with
$servertime = ($mech->response()->header("Date"));and the local time with
$loctime = localtime(time);but I'm getting the wrong date returned. For example, it is currently October (and it displays this on my computer's clock) but when I call the above code, and then parse it with
@servertime = strptime($servertime); @loctime = strptime($loctime);
I get the following two values:
112 9 31 04 25 06
112 9 30 21 25 05
The above date says that it's September, and since I'm trying to then use Delta_DHMS, it complains that it's an invalid date because I'm trying to tell it that it's September 31...which it's obviously not.
Can anyone think of an easy way to just increment the month so it's 10, or why I might be getting the wrong month from both this server and my own local machine?
Thanks for your help,
Garrett
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize wrong month
by NetWallah (Canon) on Oct 31, 2012 at 06:18 UTC | |
|
Date arithmetic is not recommended
by space_monk (Chaplain) on Oct 31, 2012 at 06:59 UTC | |
by gsparx (Novice) on Nov 02, 2012 at 22:55 UTC |