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 TimePoint

A point on the time scale. An object of this class represents a specific point in time regardless of time zone or locale.

Time points are immutable objects that can converted to and from the standard PHP time objects DateTime or time in seconds since 1 January 1970 (i.e. Epoch time).

New time points can be calculated relative to this time point, using the methods forward, back, next, floor, ceil and round.

ISO 8601 representations of date and time can be obtained by calling the date, weekDate, ordinalDate, time or dateTime methods supplying a local time zone and a locale (for week dates).

Convenience methods for creating time points for the current time and for the beginning of the current day are also included.

Namespace: Apptus\ESales\Connector\Time
Located at Connector/Time/TimePoint.php
Methods summary
public static Apptus\ESales\Connector\Time\TimePoint
# now( )

Returns a time point representing the current time.

Returns a time point representing the current time.

Returns

Apptus\ESales\Connector\Time\TimePoint
public static Apptus\ESales\Connector\Time\TimePoint
# today( DateTimeZone $tz )

Returns a time point representing that start of today.

Returns a time point representing that start of today.

Parameters

$tz

Returns

Apptus\ESales\Connector\Time\TimePoint
public static Apptus\ESales\Connector\Time\TimePoint
# fromTimestamp( float|integer $timestamp )

Converts a PHP timestamp to a time point.

Converts a PHP timestamp to a time point.

Parameters

$timestamp
float (for sub-second precision) or an integer with seconds since 1 January 1970 00:00:00.

Returns

Apptus\ESales\Connector\Time\TimePoint
public static Apptus\ESales\Connector\Time\TimePoint
# fromDateTime( DateTime $datetime )

Converts a PHP DateTime object to a time point.

Converts a PHP DateTime object to a time point.

Note that \DateTime does not have millisecond precision.

Parameters

$datetime

Returns

Apptus\ESales\Connector\Time\TimePoint
public static Apptus\ESales\Connector\Time\TimePoint
# fromMillis( string $millis )

Converts a Java timestamp to a time point.

Converts a Java timestamp to a time point.

Parameters

$millis
since 1 January 1970 00:00:00. Note that it is given as a string to avoid problems with 32 bit PHP.

Returns

Apptus\ESales\Connector\Time\TimePoint
public static Apptus\ESales\Connector\Time\TimePoint
# parse( string $iso, DateTimeZone $tz )

Parses a date-time specification as defined by ISO 8601 and returns a time point valid for the specified date-time.

Parses a date-time specification as defined by ISO 8601 and returns a time point valid for the specified date-time.

Parameters

$iso
input string.
$tz
local time zone.

Returns

Apptus\ESales\Connector\Time\TimePoint
public Apptus\ESales\Connector\Time\TimePoint
# forward( Apptus\ESales\Connector\Time\Duration $duration, DateTimeZone $tz )

Returns a new time point moved forward the length of a duration.

Returns a new time point moved forward the length of a duration.

Parameters

$duration
duration to move forward.
$tz
local time zone.

Returns

Apptus\ESales\Connector\Time\TimePoint
A new time point.
public Apptus\ESales\Connector\Time\TimePoint
# back( Apptus\ESales\Connector\Time\Duration $duration, DateTimeZone $tz )

Returns a new time point moved back the length of a duration.

Returns a new time point moved back the length of a duration.

Parameters

$duration
duration to move back.
$tz
time zone.

Returns

Apptus\ESales\Connector\Time\TimePoint
A new time point.
public Apptus\ESales\Connector\Time\CalendarDate
# date( DateTimeZone $tz )

Return the date of this TimePoint for the given time zone.

Return the date of this TimePoint for the given time zone.

Parameters

$tz
time zone.

Returns

Apptus\ESales\Connector\Time\CalendarDate
A CalendarDate object.
public
# weekDate( DateTimeZone $tz )
public
# ordinalDate( DateTimeZone $tz )
public Apptus\ESales\Connector\Time\Time
# time( DateTimeZone $tz )

Return the time of this TimePoint for the given time zone.

Return the time of this TimePoint for the given time zone.

Parameters

$tz
time zone.

Returns

Apptus\ESales\Connector\Time\Time
A Time object.
public Apptus\ESales\Connector\Time\IsoDateTime
# dateTime( DateTimeZone $tz )

Retrun the date and time of this TimePoint for the given time zone.

Retrun the date and time of this TimePoint for the given time zone.

Parameters

$tz
time zone.

Returns

Apptus\ESales\Connector\Time\IsoDateTime
An IsoDateTime object.
public DateTime
# toDateTime( DateTimeZone $tz )

Convert this TimePoint to a standard PHP DateTime object with the given DateTimeZone.

Convert this TimePoint to a standard PHP DateTime object with the given DateTimeZone.

Parameters

$tz
time zone.

Returns

DateTime
A DateTime object.
public float|integer
# toTimestamp( )

Convert this TimePoint to a PHP timestamp, i.e. seconds since 1 January 1970 00:00:00.

Convert this TimePoint to a PHP timestamp, i.e. seconds since 1 January 1970 00:00:00.

Returns

float|integer
A float with sub-second precision or an integer, depending on how the TimePoint was created.
public string
# toMillis( )

Convert this TimePoint to a Java timestamp, i.e. milliseconds since 1 January 1970 00:00:00.

Convert this TimePoint to a Java timestamp, i.e. milliseconds since 1 January 1970 00:00:00.

Note that the result is returned as a string to avoid 32 bit integer issues.

Returns

string
public string
# __toString( )

Returns a string on the format YYYY-MM-DDTHH:MM:SSZ representing this time point.

Returns a string on the format YYYY-MM-DDTHH:MM:SSZ representing this time point.

Returns

string
Apptus ESales Connector PHP API documentation generated by ApiGen