Hi,

I am getting the dates from a page and i am using the UnixDate subroutine to get the year, month and date in a specified format. But after the UnixDate processing, for one date i am getting a day before that. The following code shows the printing before and after the UnixDate subroutine

print Dumper $tot_start_date; print Dumper $tot_end_date; print Dumper $beta_start_date; print Dumper $beta_end_date; $tot_start_date = UnixDate($tot_start_date,"%Y-%m-%d"); $tot_end_date = UnixDate($tot_end_date,"%Y-%m-%d"); $beta_start_date = UnixDate($beta_start_date,"%Y-%m-%d"); $beta_end_date = UnixDate($beta_end_date,"%Y-%m-%d"); print Dumper $tot_start_date; print Dumper $tot_end_date; print Dumper $beta_start_date; print Dumper $beta_end_date; And here is the output: $VAR1 = '2008-06-27 17:37:11 +0000'; $VAR1 = '2008-09-29 04:02:18 +0000'; $VAR1 = '2008-09-29 04:02:18 +0000'; $VAR1 = '2009-01-07 00:00:00 -0800'; $VAR1 = '2008-06-27'; $VAR1 = '2008-09-28'; $VAR1 = '2008-09-28'; $VAR1 = '2009-01-07';
If you see the second and third date in the output, it is one day before to the actual date before the UnixDate processing. Any clue on this? is the time on the date making a difference? How to get the exact date. Atleast i dont want to use regular expression to extract the date. Thanks in advance,

In reply to UnixDate - getting a different date by d-evil

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.