Overview

Namespaces

  • NGS
    • Client
      • Exception
    • Converter
    • Patterns
  • PHP

Classes

  • BigDecimal
  • BigInt
  • ByteStream
  • LocalDate
  • Location
  • Money
  • Name
  • Point
  • S3
  • Timestamp
  • Utils
  • UUID
  • Overview
  • Namespace
  • Class
  • Tree

Class LocalDate

Date object with timezone Internally uses core \Datetime object

Namespace: NGS
Located at LocalDate.php
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

InvalidArgumentException
If cannot initalize from given type
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

InvalidArgumentException
If any element is null or invalid type for LocalDate constructor
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

$other
NGS\LocalDate
$other Instance of NGS\LocalDate
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

DateTime
Time value as DateTime instance
public NGS\Timestamp
# toTimestamp( )

Gets as \NGS\Timestamp instance

Gets as \NGS\Timestamp instance

Returns

NGS\Timestamp
Time value as NGS\Timestamp instance
Constants summary
string DEFAULT_TIMEZONE 'UTC'
#
string STRING_FORMAT 'Y-m-d'
#
string FALLBACK_FORMAT 'Y-m-d\\TH:i:s'
#
Properties summary
protected DateTime $datetime
#

$value

$value

Magic properties summary
public DateTime $value
#

Returns DateTime object

Returns DateTime object

API documentation generated by ApiGen 2.8.0