NAME
DateTime::Natural::Parse - Create machine readable date/time with natural parsing logic
SYNOPSIS
use DateTime::Natural::Parse qw(natural_parse);
$dt = natural_parse($date_string);
DESCRIPTION
DateTime::Natural::Parse
exports a function, natural_parse()
, by default which takes a string with a human readable date/time and creates a machine readable one by applying natural parsing logic.
FUNCTIONS
natural_parse
Creates a DateTime
object from a human readable date/time string.
$dt = natural_parse($date_string);
$dt = natural_parse($date_string, { debug => 1 });
The options hash may contain the string 'debug' with a boolean value (0/1). Will output each token that is analysed with a trailing newline.
Returns a DateTime
object.
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
friday 1pm
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
SEE ALSO
DateTime, 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.