Overview

Namespaces

  • Apptus
    • ESales
      • Connector
        • Report
        • Time
    • Util
      • Cache
  • PHP

Classes

  • CalendarDate
  • Duration
  • IsoDate
  • IsoDateTime
  • Month
  • OrdinalDate
  • Time
  • TimeInterval
  • TimePoint
  • Unit
  • WeekDate
  • Weekday
  • Overview
  • Namespace
  • Class
  • Tree

Class TimeInterval

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.

  • Namespace: Apptus\ESales\Connector\Time
    Located at Connector/Time/TimeInterval.php
    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

    $year
    year.

    Returns

    Apptus\ESales\Connector\Time\TimeInterval
    A time interval with duration 1 year, starting at year-01-01.
    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

    Apptus\ESales\Connector\Time\TimeInterval

    A time interval with duration 3 months, starting at the first month of the quarter.

    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

    Apptus\ESales\Connector\Time\TimeInterval

    A time interval with duration 1 month, starting at the first day of the month.

    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

    $year
    year.
    $week
    week.

    Returns

    Apptus\ESales\Connector\Time\TimeInterval

    A time interval with duration 1 week, starting at the first day of the week.

    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

    Apptus\ESales\Connector\Time\TimeInterval

    A time interval with duration 1 day, starting at 00:00:00 on the specified day.

    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

    Apptus\ESales\Connector\Time\TimeInterval

    A time interval with duration 1 day, starting at 00:00:00 today.

    public static Apptus\ESales\Connector\Time\TimeInterval
    # create( Apptus\ESales\Connector\Time\IsoDateTime|Apptus\ESales\Connector\Time\Duration $start, Apptus\ESales\Connector\Time\IsoDateTime|Apptus\ESales\Connector\Time\Duration $end )

    Create a TimeInterval between two IsoDateTime instances or from an IsoDateTime and a Duration.

    Create a TimeInterval between two IsoDateTime instances or from an IsoDateTime and a Duration.

    At least one of the arguments must be an IsoDateTime.

    Parameters

    $start
    point or duration of the interval.
    $end
    point or duration of the interval.

    Returns

    Apptus\ESales\Connector\Time\TimeInterval

    Throws

    InvalidArgumentException
    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

    $iso
    input string.

    Returns

    Apptus\ESales\Connector\Time\TimeInterval
    A time interval.

    Throws

    InvalidArgumentException
    if the input cannot be parsed.
    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

    $tz
    local time zone.

    Returns

    Apptus\ESales\Connector\Time\TimePoint
    The start point in time.
    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

    $tz
    local time zone.

    Returns

    Apptus\ESales\Connector\Time\TimePoint
    The end point in time.
    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

    $tz
    local time zone.

    Returns

    Apptus\ESales\Connector\Time\Duration
    The length of this time interval.
    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

    $o

    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

    $tz
    local time zone.

    Returns

    float|integer
    The length in seconds of this interval.
    Apptus ESales Connector PHP API documentation generated by ApiGen