1Rose::DateTime::Parser(U3s)er Contributed Perl DocumentatRioosne::DateTime::Parser(3)
2
3
4

NAME

6       Rose::DateTime::Parser - DateTime parser object.
7

SYNOPSIS

9         use Rose::DateTime::Parser;
10
11         $parser = Rose::DateTime::Parser->new(time_zone => 'UTC');
12
13         $dt = $parser->parse_date('4/30/2001 8am')
14           or warn $parser->error;
15

DESCRIPTION

17       Rose::DateTime::Parser encapsulates a particular kind of call to
18       Rose::DateTime::Util's parse_date and parse_european_date functions.
19       The object maintains the desired time zone, which is then passed to
20       each call.
21
22       This class inherits from, and follows the conventions of, Rose::Object.
23       See the Rose::Object documentation for more information.
24

CONSTRUCTOR

26       new PARAMS
27           Constructs a new Rose::DateTime::Parser object based on PARAMS,
28           where PARAMS are name/value pairs.  Any object method is a valid
29           parameter name.
30

OBJECT METHODS

32       error [ERROR]
33           Get or set the error message string.
34
35       european [BOOL]
36           Get or set a boolean value that controls how the parse_date method
37           will interpret "xx/xx/xxxx" dates: either month/day/year or
38           year/month/day.
39
40           If true, then the parse_date method will pass its arguments to
41           Rose::DateTime::Util's parse_european_date function, which
42           interprets such dates as "dd/mm/yyyy".
43
44           If false, then the parse_date method will temporarily force non-
45           European date parsing and then call Rose::DateTime::Util's
46           parse_date function, which will interpret the date as "mm/dd/yyyy".
47
48           This attribute defaults to the value returned by the
49           Rose::DateTime::Util->european_dates class method called at the
50           time the Rose::DateTime::Parser object is constructed.
51
52           If the BOOL argument is undefined (instead of "false, but defined")
53           then the attribute will return to its default value by calling the
54           Rose::DateTime::Util->european_dates class method again.  To
55           unambiguously set the attribute to true or false, pass a defined
56           value like 1 or 0.
57
58       parse_date STRING
59           Attempt to parse STRING by passing it to Rose::DateTime::Util's
60           parse_date or parse_european_date function.  The choice is
61           controlled by the european attribute.
62
63           If parsing is successful, the resulting DateTime object is
64           returned.  Otherwise, error is set and false is returned.
65
66       parse_datetime STRING
67           This method is an alias for parse_date()
68
69       parse_european_date STRING
70           Attempt to parse STRING by passing it to Rose::DateTime::Util's
71           parse_european_date function (regardless of the value of the
72           european attribute). If parsing is successful, the resulting
73           DateTime object is returned.  Otherwise, error is set and false is
74           returned.
75
76       time_zone [STRING]
77           Get or set the time zone string passed to Rose::DateTime::Util's
78           parse_date function.  Defaults to the value returned by the
79           Rose::DateTime::Util->time_zone class method.
80

AUTHOR

82       John C. Siracusa (siracusa@gmail.com)
83

LICENSE

85       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
86       program is free software; you can redistribute it and/or modify it
87       under the same terms as Perl itself.
88
89
90
91perl v5.34.0                      2021-07-22         Rose::DateTime::Parser(3)
Impressum