Rose::DateTime::Parser(3pm) | User Contributed Perl Documentation | Rose::DateTime::Parser(3pm) |
Rose::DateTime::Parser - DateTime parser object.
use Rose::DateTime::Parser; $parser = Rose::DateTime::Parser->new(time_zone => 'UTC'); $dt = $parser->parse_date('4/30/2001 8am') or warn $parser->error;
Rose::DateTime::Parser encapsulates a particular kind of call to Rose::DateTime::Util's parse_date and parse_european_date functions. The object maintains the desired time zone, which is then passed to each call.
This class inherits from, and follows the conventions of, Rose::Object. See the Rose::Object documentation for more information.
If true, then the parse_date method will pass its arguments to Rose::DateTime::Util's parse_european_date function, which interprets such dates as "dd/mm/yyyy".
If false, then the parse_date method will temporarily force non-European date parsing and then call Rose::DateTime::Util's parse_date function, which will interpret the date as "mm/dd/yyyy".
This attribute defaults to the value returned by the Rose::DateTime::Util->european_dates class method called at the time the Rose::DateTime::Parser object is constructed.
If the BOOL argument is undefined (instead of "false, but defined") then the attribute will return to its default value by calling the Rose::DateTime::Util->european_dates class method again. To unambiguously set the attribute to true or false, pass a defined value like 1 or 0.
If parsing is successful, the resulting DateTime object is returned. Otherwise, error is set and false is returned.
John C. Siracusa (siracusa@gmail.com)
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2022-06-17 | perl v5.34.0 |