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


In reply to WWW::Mechanize wrong month by gsparx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.