Date::CommonFormats - Common date formats made simple.
Version 0.05
Date::CommonFormats provides a super simple interface for formatting very common types of dates used on web pages and in RSS feeds.
use Date::CommonFormats qw(:all); print format_date_w3c($timestamp); print format_date_rss($datetime); print format_date_usenglish_long_ampm($datetime);
Most of these functions expect as input a datetime value in the standard mysql format such as 2011-02-02 01:02:03. format_date_integer and format_date_usenglish can accept date or datetime
You can import all functions, however none are imported by default. use Date::CommonFormats qw(:all); Importing all functions should be safe as the names are quite unique.
Use this function for reducing a date or datetime to an integer useful in comparisons.
if (format_date_integer($date1) > format_date_integer($date2)) { if (format_date_integer($datetime1) > format_date_integer($datetime2)) {
... }
Use this for formatting dates in the proper format for an RSS feed. In other words: RFC-822.
my $rss_formatted_date = format_date_rss($datetime);
Use this for formatting dates in US English similar to what you would see in a US newspaper or blog entry.
my $formatted_date = format_date_usenglish($date); my $formatted_date = format_date_usenglish($datetime);
Use this for formatting dates in US English similar to what you would see in a US newspaper or blog entry. This is the same as usenglish except it includes the time in AM/PM format.
my $formatted_date = format_date_usenglish_long_ampm($datetime);
Use this for formatting dates in short 24 hour format which is useful in a CRUD list screen where you need to see and sort by datetime but need to conserve space on the page by keeping your columns narrow.
my $formatted_date = format_date_cms_publishdate($datetime);
Use this for formatting dates in the W3C accepted format as described by ISO 8601. This can be useful for certain XML applications.
my $formatted_date = format_date_w3c($datetime);
Chris Fulton, <chris at masonqm.com>
<chris at masonqm.com>
Please report any bugs or feature requests to bug-date-commonformats at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-CommonFormats. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-date-commonformats at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Date::CommonFormats
You can also look for information at:
GITHUB
https://github.com/masonqm/Date-CommonFormats
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-CommonFormats
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Date-CommonFormats
CPAN Ratings
http://cpanratings.perl.org/d/Date-CommonFormats
Search CPAN
http://search.cpan.org/dist/Date-CommonFormats/
Copyright 2011 Chris Fulton.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Date::CommonFormats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Date::CommonFormats
CPAN shell
perl -MCPAN -e shell install Date::CommonFormats
For more information on module installation, please visit the detailed CPAN module installation guide.