in reply to Date question

use HTTP::Date;

Replies are listed 'Best First'.
Re^2: Date question
by htmanning (Friar) on Oct 30, 2008 at 21:57 UTC
    I must be doing something wrong. I have use HTTP::Date; in there and I call it like this:

    $date2 = parse_date($date);

    but this gets returned:

    "Undefined subroutine &main::parse_date called at line 986"

      parse_date() is not exported by default, so you can either write

      $date2 = HTTP::Date::parse_date($date);

      or import the function into your namespace

      use HTTP::Date qw(parse_date);

      (See Exporter for what this is about)

        Thanks for the help. That worked, sort of. Here's the deal. I have a date formatted in a field like this:

        2008-10-30

        But when my script pulls it out for the RSS feed, the feed count is as a day ealier even though, if I look at the source of the feed it's correct. So a story published today has a pubDate of 2008-10-30 (and it's correct in the source), but viewing the feed it says the date is 2008-10-29. So I thought that by changing it to the GMT format my problem would be fixed. It's not.

        When I run this parser it just turns 2008-10-30 into:

        2008-10-30 00:00:00

        Any ideas?