Loading ...
Sorry, an error occurred while loading the content.

Re: [RSS2-Support] conversion to ISO 8601 format

Expand Messages
  • Klaus Johannes Rusch
    ... Unless you want to format the date yourself if you have year, month, day, hour, minute and second in separate variables already, you can use the DateTime
    Message 1 of 2 , Aug 11, 2005
    • 0 Attachment
      Monica L wrote:

      >I'm fairly new to RSS, and I'm working on a program
      >that needs to convert the <pubDate> from the RFC 822
      >format to the ISO 8601 format. Does anyone know if
      >there are any Perl modules that will do this
      >conversion? I heard of the Date::Manip module, but
      >I'm not sure if this is the right module to use or if
      >there are other ones?
      >
      >

      Unless you want to format the date yourself if you have year, month,
      day, hour, minute and second in separate variables already, you can use
      the DateTime modules:

      use DateTime;
      use DateTime::Format::Strptime;

      # Define parser format
      my $parserymdhms = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d
      %H:%M:%S' );

      print $parserymdhms->parse_datetime("2005-11-08 14:15:27")->iso8601;

      --
      Klaus Johannes Rusch
      KlausRusch@...
      http://www.atmedia.net/KlausRusch/
    Your message has been successfully submitted and would be delivered to recipients shortly.