The manakai project

Web::DateTime::Interval

Interval between dates for Web

SYNOPSIS

  use Web::DateTime::Interval;
  $interval = Web::DateTime::Interval->new_from_start_and_end ($dt1, $dt2);
  warn $interval->to_start_and_end_string;

DESCRIPTION

The Web::DateTime::Interval class represents a time interval between two dates and times.

METHODS

Following methods are available:

$interval = Web::DateTime::Interval->new_from_start_and_end ($dt1, $dt2)

Create a new interval object from start and end Web::DateTime objects. The first date/time must be less than or equal to the second date/time.

$interval = Web::DateTime::Interval->new_from_start_and_duration ($dt, $duration)

Create a new interval object from start Web::DateTime object and Web::DateTime::Duration object. The duration must be positive and must not have non-zero months.

false = $interval->is_date_time
false = $interval->is_time_zone
false = $interval->is_duration
true = $interval->is_interval

Return whether the object is of the specified type or not.

$dt = $interval->start_date_time

Return the Web::DateTime object representing the start date and time of the interval.

$dt = $interval->end_date_time

Return the Web::DateTime object representing the end date and time of the interval.

$duration = $interval->duration

Return the Web::DateTime::Duration object representing the duration between the start and end dates and times.

$string = $interval->to_start_and_end_string

Return the string representing the interval, using the format of two valid global date and time strings, which is appropriate for vEvent microdata [HTML].

This can also be used as an ISO 8601 time interval representation in most cases.

$string = $interval->to_start_and_duration_string

Return the string representing the interval, using the format of a valid global date and time string and an vevent duration string, which is appropriate for vEvent microdata [HTML].

This can also be used as an ISO 8601 time interval representation in most cases.

SPECIFICATION

HTML

HTML Standard <http://www.whatwg.org/specs/web-apps/current-work/>.

AUTHOR

Wakaba <wakaba@suikawiki.org>.

LICENSE

Copyright 2014 Wakaba <wakaba@suikawiki.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.