NAME
DateTime::Format::Natural::EN - Create machine readable date/time with natural parsing logic
SYNOPSIS
use DateTime::Format::Natural::EN;
$parse = DateTime::Format::Natural::EN->new();
$dt = $parse->parse_datetime($date_string);
DESCRIPTION
DateTime::Format::Natural::EN
consists of a method, parse_datetime()
, which takes a string with a human readable date/time and creates a machine readable one by applying natural parsing logic.
FUNCTIONS
new
Creates a new DateTime::Format::Natural::EN object.
parse_datetime
Creates a DateTime
object from a human readable date/time string.
$dt = $parse->parse_datetime($date_string);
$dt = $parse->parse_datetime(string => $date_string, debug => 1);
The options may contain the keys 'string' and 'debug'. Former one may consist of the datestring, whereas latter one holds the boolean value for the debugging option. If debugging is enabled, each token that is analysed will be output to stdout with a trailing newline.
Returns a DateTime
object.
format_datetime
Not implemented yet.
EXAMPLES
Below are some examples of human readable date/time input:
Simple
thursday
november
friday 13:00
mon 2:35
4pm
6 in the morning
sat 7 in the evening
yesterday
today
tomorrow
this tuesday
next month
this morning
this second
yesterday at 4:00
last friday at 20:00
last week tuesday
tomorrow at 6:45pm
afternoon yesterday
thursday last week
Complex
3 years ago
5 months before now
7 hours ago
7 days from now
in 3 hours
1 year ago tomorrow
3 months ago saturday at 5:00pm
4th day last week
3rd wednesday in november
3rd month next year
7 hours before tomorrow at noon
Specific Dates
January 5
dec 25
may 27th
October 2006
february 14, 2004
Friday
jan 3 2010
3 jan 2000
27/5/1979
4:00
17:00
SEE ALSO
DateTime, Date::Calc, http://datetime.perl.org/
AUTHOR
Steven Schubiger <schubiger@cpan.org>
LICENSE
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.