in reply to Converting timestamp to RSS pubDate

So what did you do with HTTP::Date that did not work? It's a lot easier for us to help you if you show us your code.

Just to give you a clue, HTTP::Date::time2str takes epoch time. You can actually make life much easier for yourself by getting the timestamp out of the database in the format that time2str is looking for.

Have a look at UNIX_TIMESTAMP() in the MySQL Reference Manual. Also have a look at the very powerful DATE_FORMAT() function whilst you are there - you could theoretically do the whole thing in MySQL before Perl even sees it. I just find it easier to use HTTP::Date::time2str rather than messing about with % type format strings.

  • Comment on Re: Converting timestamp to RSS pubDate

Replies are listed 'Best First'.
Re^2: Converting timestamp to RSS pubDate
by htmanning (Friar) on Nov 04, 2008 at 01:29 UTC
    I've tried the following
    $http_date = time2str( str2time("$timestamp", "-0600") );

    and...

    $http_date = time2str($timestamp);

    and... $http_date = parse_date($timestamp); among other things. All return dates that vary from 1969 to yesterday. I don't get it. I look at the timestamp in the database and it is set to the correct time.

    I just need to go from this:

    2008-11-03 19:03:44

    to this:

    Mon, 03 Nov 2008 20:15:00 EST