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.
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
|
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
Returns
|
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
|
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
Returns
|
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
|
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
|
public
Apptus\ESales\Connector\Time\TimePoint
|
|
public
Apptus\ESales\Connector\Time\TimePoint
|
|
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
Returns
|
public
|
|
public
|
|
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
Returns
|
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
Returns
|
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
Returns
|
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
|