DateTime::Parser - Locale aware Parser for DateTime $obj = new DateTime::Parser(); OR $obj = new DateTime::Parser('%d. %B %Y'); OR $obj = new DateTime::Parser('%d. %B %Y','de-AT'); my $date1 = $obj->get_time('5. Oktober 2007'); This module provides a convinient function to parse localaized datetime stings into DateTime objects. You just need to supply the used locale and a strftime string describing the pattern.

new([LOCALE])
my $obj = DateTime::Parser->new(); my $obj = DateTime::Parser->new('%d. %B %Y'); my $obj = DateTime::Parser->new('%d. %B %Y','de-AT'); my $locale = DateTime::Locale->get_locale('de-AT'); my $obj = Config::Class->new('%d. %B %Y',$locale); Creates a DateTime::Parser object and returns it. Takes the strftime format string and the locale as an optional argument. If no locale is provided it will be taken from "DateTime-"DefaultLocale()>. If the format string is omitted then the "medium_date_format" from the currently used locale will be used. The locale may be a DateTime::Locale object or a locale name as supplied to "DateTime::Locale-"get_locale>

get_locale()
Returns the currently used DateTime::Locale object.

set_locale(LOCALE)
Sets the currently used locale. Accepts the name of the locale or a DateTime::Locale object.

set_pattern(PATTERN)
Sets the pattern. The format string can be any string containing DateTime "strftime Specifiers"

get_time(TIMESTRING)
my $datetime = $obj->get_time('5. Oktober 2007') Parses the given datetime strings and returns a datetime object. If the string cannot be parsed the method returns undef.

strftime Specifiers
This module can parse all existing strftime specifiers and also a couple of method specififiers ("%{method_name}"), but it can only use some of them to construct a datetime object, since not all specifiers are easily (or event at all) reversible. Supported DateTime Methods * item ce_year * item year * item month, mon * item day,mday * item hour * item minute * item second * item time * item ymd * item mdy * item dmy * item month_name * item month_abbr * item day_name * item day_abbr * item hour_12 * item quarter * item quarter_name * item quarter_abbr * item millisecond * item microsecond * item nanosecond * item datetime * item iso8601 * item hms * item offset * item epoch * item time_zone_long_name Unsupported DateTime Methods * item era_abbr * item christian_era * item secular_era * item day_of_quarter * item doq * item year_with_era * item year_with_christian_era * item year_with_secular_era * item hour_1 * item hour_12_0 * item fractional_second * item week * item week_year * item week_number * item jd * item mjd * item hires_epoch Reversible Strftime Specifiers Only the specifiers clearly indicating a single timezone, year, month, day, hour, minute, second or nanosecond can be used to construct a DateTime object. This module cannot work with dates from BC era. Maro Kollár CPAN ID: MAROS maros [at] k-1.com http://www.k-1.com DateTime::Parser is Copyright (c) 2006,2007 Maro Kollár. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. The DateTime module by Dave Rolsky.