in reply to Converting timestamp to RSS pubDate

The target date with HTTP::Date is always in GMT...  So, here's another suggestion:

use Date::Manip; my $date = "2008-11-03 19:03:44"; Date_Init("TZ=EST"); my $http_date = UnixDate(ParseDate("$date -0612"), "%a, %d %b %Y %H:%M +:%S %Z"); print "$http_date\n"; # Mon, 03 Nov 2008 20:15:44 EST

Not fully matching your requirement, but close :) — Adjust the input time zone (-0612) as appropriate.

(If you seriously want to go from 19:03:44 to 20:15:00, look into the other functionality that Date::Manip has to offer for calculating with dates...)

Replies are listed 'Best First'.
Re^2: Converting timestamp to RSS pubDate
by htmanning (Friar) on Nov 04, 2008 at 01:51 UTC
    Thanks. This sort of worked but here what's weird. In the HTML code this was printed:

    <pubDate>Mon, 03 Nov 2008 21:37:50 EST</pubDate>

    If I look at the RSS Feed in Firefox or IE it reads this:

    Monday, November 03, 2008 4:37 PM

    I have no idea why. Any ideas? The 4:37 should read 9:37 shouldn't it? Also, the server is EST and it's only 8:37 there now so somewhere I'm gaining an hour.

      Why don't you just fiddle with the <pubDate>Mon, 03 Nov 2008 21:37:50 EST</pubDate> value until Firefox/IE is showing the correct date?  Try time zones other than EST (maybe it's expecting GMT, as would've been output by HTTP::Date), increment/decrement the hour, etc.  Shouldn't be too hard to eventually figure out how Firefox is interpreting the pubDate value...