An interval between two points in time.
The interval may be expressed as either a start and an end time, or as
one of those and a duration.
This class represents the ISO 8601 time interval concept, which allows
the different formats to express a time interval:
<start>/<duration>
<start>/<end>
<duration>/<end>
where start and end is specified using ISO 8601 date and time, while
a duration is specified using a ISO 8601 duration.
Methods summary
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
year( integer $year )
Convenience method for returning a time interval covering a complete
calendar year. The start date is expressed in local time.
Convenience method for returning a time interval covering a complete
calendar year. The start date is expressed in local time.
Parameters
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
quarter( integer $year, integer $quarter )
Convenience method for returning a time interval covering a complete
calendar quarter. The start date is expressed in local time.
Convenience method for returning a time interval covering a complete
calendar quarter. The start date is expressed in local time.
Parameters
- $year
- year.
- $quarter
- quarter.
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
month( integer $year, integer $month )
Convenience method for returning a time interval covering a complete
calendar month. The start date is expressed in local time.
Convenience method for returning a time interval covering a complete
calendar month. The start date is expressed in local time.
Parameters
- $year
- year.
- $month
- month.
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
week( integer $year, integer $week )
Convenience method for returning a time interval covering a complete
calendar week according to the ISO 8601 week rules. The start date is
expressed in local time.
Convenience method for returning a time interval covering a complete
calendar week according to the ISO 8601 week rules. The start date is
expressed in local time.
Parameters
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
day( integer $year, integer $month, integer $day )
Convenience method for returning a time interval covering a complete
calendar day.
Convenience method for returning a time interval covering a complete
calendar day.
Parameters
- $year
- year.
- $month
- month.
- $day
- day.
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
today( DateTimeZone $tz )
Convenience method for returning a time interval covering today.
The start date is expressed in local time.
Convenience method for returning a time interval covering today.
The start date is expressed in local time.
Parameters
- $tz
- zone to decide which day is "today".
Returns
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
|
public static
Apptus\ESales\Connector\Time\TimeInterval
|
#
parse( string $iso )
Parses a time interval on any of the three valid formats.
Parses a time interval on any of the three valid formats.
Parameters
Returns
Throws
|
public
Apptus\ESales\Connector\Time\TimePoint
|
#
start( DateTimeZone $tz )
Returns the start point in time, given the time zone for local time.
Returns the start point in time, given the time zone for local time.
Parameters
Returns
|
public
Apptus\ESales\Connector\Time\TimePoint
|
#
end( DateTimeZone $tz )
Returns the end point in time, given the time zone for local time.
Returns the end point in time, given the time zone for local time.
Parameters
Returns
|
public
Apptus\ESales\Connector\Time\Duration
|
#
duration( DateTimeZone $tz )
Returns the duration of this time interval, given the time zone for local time.
Returns the duration of this time interval, given the time zone for local time.
If this interval was specified by start and end times, the duration is
calculated using the given time zone.
Note that if the duration is calculated, it will be specified in hours,
minutes and seconds only. The number of hours may be very large for long
intervals.
Parameters
Returns
|
public
boolean
|
#
equals( mixed $o )
True if the argument is a time interval specified by the very same
components as this time interval.
True if the argument is a time interval specified by the very same
components as this time interval.
Two time intervals may cover the same
set of time points in all time zones and for all locales and still not be
considered equal, depending on how they are specified.
Parameters
Returns
boolean
|
public
string
|
#
__toString( )
Returns an ISO 8601 formatted string representing this time interval.
Returns an ISO 8601 formatted string representing this time interval.
Returns
string
|
public
float|integer
|
#
toSeconds( DateTimeZone $tz )
Returns the length in seconds for this time interval,
given a local time zone.
Returns the length in seconds for this time interval,
given a local time zone.
Parameters
Returns
float|integer The length in seconds of this interval.
|