Class LocalDate
Date object with timezone Internally uses core \Datetime object
Methods summary
public
|
#
__construct( DateTime |NGS\DateTime|string|integer|float|null $value = 'now', string $pattern = NGS\LocalDate::STRING_FORMAT , string $timezone = NGS\LocalDate::DEFAULT_TIMEZONE )
Constructs a new LocalDate instance
Constructs a new LocalDate instance
Parameters
- $value
DateTime |NGS\DateTime|string|integer|float|null
$value Instance of \DateTime or \NGS\LocalDate, valid string format, date as
int/float, or null for current time
- $pattern
string $timezone|null string representation of a timezone, null defaults to 'UTC'
- $timezone
string $pattern format in which to parse the date, defaults to 'Y-m-d\\TH:i:s.uP'
Throws
|
public static
array
|
#
toArray( array $items, mixed $allowNullValues = false )
Converts all elements in array to \NGS\LocalDate instance
Converts all elements in array to \NGS\LocalDate instance
Parameters
- $items
array $items Source array, each element must be a valid argument for LocalDate
constructor
- $allowNullValues
Returns
array Resulting array of LocalDate instances
Throws
|
public
string
|
#
__toString( )
Returns time in default format 'Y-m-d\\TH:i:s.uP'
Returns time in default format 'Y-m-d\\TH:i:s.uP'
Returns
string formatted date with time zone
|
public
string
|
#
format( mixed $pattern )
Returns time in default format 'Y-m-d\\TH:i:s.uP'
Returns time in default format 'Y-m-d\\TH:i:s.uP'
Returns
string formatted date with time zone
|
public
|
#
equals( NGS\LocalDate $other )
Checks for equality against another LocalDate instance
Checks for equality against another LocalDate instance
Parameters
|
public
integer
|
#
toInt( )
Gets time in Unix timestamp
Gets time in Unix timestamp
Returns
integer Unix timestamp
|
public
DateTime
|
#
toDateTime( )
Gets time value as Datetime instance
Gets time value as Datetime instance
Returns
|
public
NGS\Timestamp
|
#
toTimestamp( )
Gets as \NGS\Timestamp instance
Gets as \NGS\Timestamp instance
Returns
|