DateTime::Format::GnuAt - Parse time specifications as Debian 'at' command.
use DateTime::Format::GnuAt; $parser = DateTime::Format::GnuAt->new; $dt = $parser->parse_datetime("today"); $dt = $parser->parse_datetime("next week + 3 days");
This module implements the same parser rules as Debian 'at' command (which is also the 'at' used by most non Debian based Linux distributions).
at manual page:
atallows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form
HH:MMto run a job at a specific time of day. (If that time is already past, the next day is assumed.) You may also specify
teatime(4pm) and you can have a time-of-day suffixed with
PMfor running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form
month-name daywith an optional
year, or giving a date of the form
[CC]YY-MM-DD. The specification of a date must follow the specification of the time of day. You can also give times like
now + count time-units, where the time-units can be
weeksand you can tell at to run the job today by suffixing the time with
todayand to run the job tomorrow by suffixing the time with
For example, to run a job at 4pm three days from now, you would do
at 4pm + 3 days, to run a job at 10:00am on July 31, you would do
at 10am Jul 31and to run a job at 1am tomorrow, you would do
at 1am tomorrow.
The definition of the time specification can be found in
The module provides the following methods:
Returns a new date-time parser object.
Parses the given string and returns a DateTime object. On failure it croaks.
The following options can also be passed to the method as a list of
$key = $value> pairs after the date-time specification:
A DateTime object to be used as the current "now".
This allows to parse the date-time specifications relative to a custom date.
It can also be used to set the default time-zone (by default
local is used).
Salvador Fandiño, <firstname.lastname@example.org>
Copyright (C) 2013 by Qindel Formación y Servicios, S.L.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
The Perl code in this module has been written from scratch, though the source code of the Debian
at command was used for inspiration and to determine undocumented behavior.
And excerpt from the at(1) man page has also been copied here.
The test suite is an adaptation of the
parsetime.pl script also distributed in the
reference directory contains the original C files and their copyright conditions.