<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: cfmonth code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 01:57:18 GMT</pubDate>
    <description>DZone Snippets: cfmonth code</description>
    <item>
      <title>DateTime: generic date and time script in perl</title>
      <link>http://snippets.dzone.com/posts/show/927</link>
      <description>&lt;code&gt;&lt;br /&gt;### begin_: file metadata&lt;br /&gt;    ### &lt;region-file_info&gt;&lt;br /&gt;    ### main:&lt;br /&gt;    ###   - name : DateTime.pl&lt;br /&gt;    ###     desc : DateTime: generic date and time script in perl&lt;br /&gt;    ###     date : created="Thu 2005-12-01 10:04:52"&lt;br /&gt;    ###     last : lastmod="Thu 2005-12-01 10:04:59"&lt;br /&gt;    ### &lt;/region-file_info&gt;&lt;br /&gt;&lt;br /&gt;### begin_: initialize perl (optional)&lt;br /&gt;    use strict;&lt;br /&gt;    use warnings;&lt;br /&gt;&lt;br /&gt;### begin_: initialize DateTime values&lt;br /&gt;    my %dttime = ();&lt;br /&gt;    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);&lt;br /&gt;&lt;br /&gt;### begin_: initialize DateTime number formats&lt;br /&gt;    $dttime{year }  = sprintf "%04d",($year + 1900);  ## four digits to specify the year&lt;br /&gt;    $dttime{mon  }  = sprintf "%02d",($mon + 1);      ## zeropad months&lt;br /&gt;    $dttime{mday }  = sprintf "%02d",$mday;           ## zeropad day of the month&lt;br /&gt;    $dttime{wday }  = sprintf "%02d",$wday + 1;       ## zeropad day of week; sunday = 1;&lt;br /&gt;    $dttime{yday }  = sprintf "%02d",$yday;           ## zeropad nth day of the year&lt;br /&gt;    $dttime{hour }  = sprintf "%02d",$hour;           ## zeropad hour&lt;br /&gt;    $dttime{min  }  = sprintf "%02d",$min;            ## zeropad minutes&lt;br /&gt;    $dttime{sec  }  = sprintf "%02d",$sec;            ## zeropad seconds&lt;br /&gt;    $dttime{isdst}  = $isdst;&lt;br /&gt;&lt;br /&gt;### begin_: xnpDate print iso8601 version date&lt;br /&gt;    print "$dttime{year}-$dttime{mon}-$dttime{mday}\n";&lt;br /&gt;&lt;br /&gt;### begin_: xnpNow show system time&lt;br /&gt;    print "$dttime{year}-$dttime{mon}-$dttime{mday} $dttime{hour}:$dttime{min}:$dttime{sec} \n";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Fri, 02 Dec 2005 05:27:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/927</guid>
      <author>drefty (drefty)</author>
    </item>
  </channel>
</rss>
