Date::CommonFormats 0.04 Released!
Posted Jun 15th, 2011 12:00 PM
I have cleaned up this module a bit. Here are some of the changes:
0.04 Mon Jun 13 17:00:00 PDT 2011
- Added DateTime::Format::MySQL for format checking
- Fixed bug in w3c year - was not padding 4 spaces
- STarting to use DateTime object instead of splitting by hand for most functions
0.03 Mon Jun 13 14:00:00 PDT 2011
- Fixed undefined time values when only passed a date
- Added Carp croak on bad date/datetime instead of returning ""
0.02 Sun Jun 5 12:00:00 PDT 2011
- Fixed Makefile.PL dependencies
Last time I didn't go into detail about the specific features provided by Date::CommonFormats so here is a quick overview:
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.
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);
Enjoy!
Don't have a free account? Become a member!