Date
in package
implements
JsonSerializable, Stringable
Read onlyYes
FinalYes
Calendar date without time of day.
Invoice dates are legal dates in the issuer's time zone. Storing them as year/month/day makes it impossible for a UTC conversion to shift them to the previous or next day.
Table of Contents
Interfaces
- JsonSerializable
- Stringable
Properties
Methods
- __toString() : string
- addDays() : self
- compareTo() : int
- diffInDays() : int
- equals() : bool
- format() : string
- fromFormat102() : self
- Strict CII date in format 102 (YYYYMMDD), as used for incoming documents.
- fromIsoDate() : self
- Strict ISO 8601 calendar date (YYYY-MM-DD) with an optional time zone (Z, +01:00), as used by UBL (xs:date). The time zone does not shift the calendar date.
- isAfter() : bool
- isBefore() : bool
- jsonSerialize() : string
- of() : self
- parse() : self
- Accepts ISO dates (2026-10-03), the CII format 102 (20261003), date-time strings and DateTimeInterface instances.
- toCarbon() : CarbonImmutable
- today() : self
- toFormat102() : string
- Date in UN/CEFACT format 102 (CCYYMMDD).
- toIsoString() : string
Properties
$day
public
int
$day
$month
public
int
$month
$year
public
int
$year
Methods
__toString()
public
__toString() : string
Return values
stringaddDays()
public
addDays(int $days) : self
Parameters
- $days : int
Return values
selfcompareTo()
public
compareTo(self $other) : int
Parameters
- $other : self
Return values
intdiffInDays()
public
diffInDays(self $other) : int
Parameters
- $other : self
Return values
intequals()
public
equals(self $other) : bool
Parameters
- $other : self
Return values
boolformat()
public
format(string $format) : string
Parameters
- $format : string
Return values
stringfromFormat102()
Strict CII date in format 102 (YYYYMMDD), as used for incoming documents.
public
static fromFormat102(string $value) : self
Parameters
- $value : string
Tags
Return values
selffromIsoDate()
Strict ISO 8601 calendar date (YYYY-MM-DD) with an optional time zone (Z, +01:00), as used by UBL (xs:date). The time zone does not shift the calendar date.
public
static fromIsoDate(string $value) : self
Parameters
- $value : string
Tags
Return values
selfisAfter()
public
isAfter(self $other) : bool
Parameters
- $other : self
Return values
boolisBefore()
public
isBefore(self $other) : bool
Parameters
- $other : self
Return values
booljsonSerialize()
public
jsonSerialize() : string
Return values
stringof()
public
static of(int $year, int $month, int $day) : self
Parameters
- $year : int
- $month : int
- $day : int
Return values
selfparse()
Accepts ISO dates (2026-10-03), the CII format 102 (20261003), date-time strings and DateTimeInterface instances.
public
static parse(self|DateTimeInterface|string $value[, DateTimeZone|string|null $timezone = null ]) : self
A DateTimeInterface is first converted into $timezone (if given), so that the calendar date matches the issuer's local date.
Parameters
- $value : self|DateTimeInterface|string
- $timezone : DateTimeZone|string|null = null
Return values
selftoCarbon()
public
toCarbon([DateTimeZone|string|null $timezone = null ]) : CarbonImmutable
Parameters
- $timezone : DateTimeZone|string|null = null
Return values
CarbonImmutabletoday()
public
static today([DateTimeZone|string|null $timezone = null ]) : self
Parameters
- $timezone : DateTimeZone|string|null = null
Return values
selftoFormat102()
Date in UN/CEFACT format 102 (CCYYMMDD).
public
toFormat102() : string
Return values
stringtoIsoString()
public
toIsoString() : string