NAME
Date::CommonFormats - Common date formats made simple.
VERSION
Version 0.05
SYNOPSIS
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
EXPORT
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.
SUBROUTINES
format_date_integer
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)) {
...
}
format_date_rss
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);
format_date_usenglish
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);
format_date_usenglish_long_ampm
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);
format_date_cms_publishdate
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);
format_date_w3c
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);
AUTHOR
Chris Fulton, <chris at masonqm.com>
BUGS
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.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Date::CommonFormats
You can also look for information at:
GITHUB
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
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.