<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rfc822 code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 07:22:29 GMT</pubDate>
    <description>DZone Snippets: rfc822 code</description>
    <item>
      <title>RFC822 and ISO8601 date formats in Perl</title>
      <link>http://snippets.dzone.com/posts/show/622</link>
      <description>Using only the standard POSIX module.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/perl -w&lt;br /&gt;&lt;br /&gt; use strict;&lt;br /&gt; use POSIX qw(strftime);&lt;br /&gt;&lt;br /&gt; my $now = time();&lt;br /&gt;&lt;br /&gt; # We need to munge the timezone indicator to add a colon between the hour and minute part&lt;br /&gt; my $tz = strftime("%z", localtime($now));&lt;br /&gt; $tz =~ s/(\d{2})(\d{2})/$1:$2/;&lt;br /&gt;&lt;br /&gt; # ISO8601&lt;br /&gt; print strftime("%Y-%m-%dT%H:%M:%S", localtime($now)) . $tz . "\n";&lt;br /&gt; # RFC822 (actually RFC2822, as the year has 4 digits)&lt;br /&gt; print strftime("%a, %d %b %Y %H:%M:%S %z", localtime($now)) . "\n";&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 01 Sep 2005 21:29:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/622</guid>
      <author>gerikson (Gustaf Erikson)</author>
    </item>
    <item>
      <title>Create an RFC822 compliant date in Perl</title>
      <link>http://snippets.dzone.com/posts/show/466</link>
      <description>&lt;code&gt;&lt;br /&gt;use Date::Manip qw(ParseDate UnixDate);&lt;br /&gt;&lt;br /&gt;# Create an RFC822 compliant date (current time)&lt;br /&gt;my $rfc822_format = "%a, %d %b %Y %H:%M %Z";&lt;br /&gt;my $today         = ParseDate("Now");&lt;br /&gt;&lt;br /&gt;my $rfc822_date   = UnixDate($today,$rfc822_format);&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Jul 2005 04:41:10 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/466</guid>
      <author>beutelevision (Thomas Beutel)</author>
    </item>
  </channel>
</rss>
