-
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::TimeZone
object.
Returns module instance with passed time zone. If timezone
parameter omitted default time zone used.
-
timezone
- either a string or aDateTime::TimeZone
object.
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
-DateTime
object. -
right
-DateTime
object.
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::Duration
object. -
right
-DateTime::Duration
object. -
start
-DateTime
object.
Returns string with DateTime
object in RFC3339 format. Shortcut for DateTime::Format::RFC3339->format_datetime
.
-
datetime
-DateTime
object.
Returns DateTime::Duration
object created from DateTime
and duration. Creates DateTime::Duration
from data if it is not blessed object.
-
datetime
-DateTime
object. -
data
-DateTime::Duration' object or hash for
DateTime::Duration->new'.
Shortcut for DateTime::Span->from_datetimes(start => start, before => end)
.
-
start
-DateTime
object. -
end
-DateTime
object.
Shortcut for DateTime::SpanSet->from_spans(spans)
.
-
spans
- reference to array ofDateTime::Span
objects.
No tests.