-
Notifications
You must be signed in to change notification settings - Fork 1
DateTimeFactory.pm
Encapsulates work with family of date objects (DateTime, DateTime::Duration, DateTime::Span and DateTime::SpanSet).
Sets timezone that will be used for new instances by default.
-
timezone- either a string or aDateTime::TimeZoneobject.
Returns module instance with passed time zone. If timezone parameter omitted default time zone used.
-
timezone- either a string or aDateTime::TimeZoneobject.
Returns current time in current time zone. Dies if time zone is not set.
Returns next day start time (midnight) in current time zone. Dies if time zone is not set.
Returns DateTime object built from unix time with time zone set to current. Dies if time zone is not set.
-
unixtime- number of seconds since 1 January 1970.
Shortcut for DateTime->compare(left, right).
-
left-DateTimeobject. -
right-DateTimeobject.
Parses input string with Date::Parse->str2time function and returns DateTime from resulting value. Returns undef if parsing fails.
-
inputstr- string contains date and time.
Parses input string with DateTime::Format::RFC3339->parse_datetime, sets current time zone to result and returns it. Dies if time zone is not set.
-
inputstr- string contains date and time in RFC3339 format.
Shortcut for DateTime::Duration->new(params).
-
params- hash of parameters forDateTime::Duration->new.
Shortcut for DateTime::Duration->compare(left, right, start).
-
left-DateTime::Durationobject. -
right-DateTime::Durationobject. -
start-DateTimeobject.
Returns string with DateTime object in RFC3339 format. Shortcut for DateTime::Format::RFC3339->format_datetime.
-
datetime-DateTimeobject.
Returns DateTime::Duration object created from DateTime and duration. Creates DateTime::Duration from data if it is not blessed object.
-
datetime-DateTimeobject. -
data-DateTime::Duration' object or hash forDateTime::Duration->new'.
Shortcut for DateTime::Span->from_datetimes(start => start, before => end).
-
start-DateTimeobject. -
end-DateTimeobject.
Shortcut for DateTime::SpanSet->from_spans(spans).
-
spans- reference to array ofDateTime::Spanobjects.
No tests.