DateTimeX::Web

DateTime factory for web apps
Download

DateTimeX::Web Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kenichi Ishigaki
  • Publisher web site:
  • http://search.cpan.org/~ishigaki/

DateTimeX::Web Tags


DateTimeX::Web Description

DateTimeX::Web is a DateTime framework, quite useful and complete. However, sometimes it's a bit too strict and cumbersome. Also, we usually need to load too many common DateTime components when we build a web application. That's not DRY.So, here's a factory to make it sweet. If you want more chocolate or cream, help yourself. The DateTime framework boasts a variety of flavors.SYNOPSIS use DateTimeX::Web # create a factory. my $dtx = DateTimeX::Web->new(time_zone => 'Asia/Tokyo'); # then, grab a DateTime object from there. my $obj = $dtx->now; # with arguments for a DateTime constructor. my $obj = $dtx->from(year => 2008, month => 2, day => 9); # or with epoch (you don't need 'epoch =>' as it's obvious). my $obj = $dtx->from_epoch(time); # or with a WWWC datetime format string. my $obj = $dtx->from_rss('2008-02-09T01:00:02'); # actually you can use any Format plugins. my $obj = $dtx->parse_as(MySQL => '2008-02-09 01:00:02'); # of course you may need to parse with strptime. my $obj = $dtx->parse('%Y-%m-%d', $string); # you may want to create a datetime string for HTTP headers. my $str = $dtx->for_http; # or for emails (you can pass an arbitrary DateTime object). my $str = $dtx->for_mail($dt); # or for database (with arguments for a DateTime constructor). my $str = $dtx->for_mysql(year => 2007, month => 3, day => 3); # actually you can use any Format plugins. my $str = $dtx->render_as(MySQL => $dt); # you want finer control? my $str = $dtx->format('mysql')->format_date($dt);Product's homepage


DateTimeX::Web Related Software