Zum Inhalt springen

API reference / Quittio \ Core \ Support

Date

final readonly class in quittio/core · implements JsonSerializable, Stringable

Quittio\Core\Support\Date · Source

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.

Methods#

MethodDescription
->__toString()
->addDays()
->compareTo()
->diffInDays()
->equals()
->format()
::fromFormat102()Strict CII date in format 102 (YYYYMMDD), as used for incoming documents.
::fromIsoDate()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()
->isBefore()
->jsonSerialize()
::of()
::parse()Accepts ISO dates (2026-10-03), the CII format 102 (20261003), date-time strings and DateTimeInterface instances.
->toCarbon()
::today()
->toFormat102()Date in UN/CEFACT format 102 (CCYYMMDD).
->toIsoString()

__toString()#

public function __toString(): string
Returns
string

addDays()#

public function addDays(int $days): self
ParameterTypeDescription
$daysint
Returns
self

compareTo()#

public function compareTo(self $other): int
ParameterTypeDescription
$otherself
Returns
int

diffInDays()#

public function diffInDays(self $other): int
ParameterTypeDescription
$otherself
Returns
int

equals()#

public function equals(self $other): bool
ParameterTypeDescription
$otherself
Returns
bool

format()#

public function format(string $format): string
ParameterTypeDescription
$formatstring
Returns
string

fromFormat102()#

public static function fromFormat102(string $value): self

static

Strict CII date in format 102 (YYYYMMDD), as used for incoming documents.

ParameterTypeDescription
$valuestring
Returns
self
Throws
InvalidArgumentException

fromIsoDate()#

public static function fromIsoDate(string $value): self

static

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.

ParameterTypeDescription
$valuestring
Returns
self
Throws
InvalidArgumentException

isAfter()#

public function isAfter(self $other): bool
ParameterTypeDescription
$otherself
Returns
bool

isBefore()#

public function isBefore(self $other): bool
ParameterTypeDescription
$otherself
Returns
bool

jsonSerialize()#

public function jsonSerialize(): string
Returns
string

of()#

public static function of(int $year, int $month, int $day): self

static

ParameterTypeDescription
$yearint
$monthint
$dayint
Returns
self

parse()#

public static function parse(
    self|DateTimeInterface|string $value,
    DateTimeZone|string|null $timezone = null,
): self

static

Accepts ISO dates (2026-10-03), the CII format 102 (20261003), date-time strings and DateTimeInterface instances.

A DateTimeInterface is first converted into $timezone (if given), so that the calendar date matches the issuer's local date.

ParameterTypeDescription
$valueself|DateTimeInterface|string
$timezoneDateTimeZone|string|null = null
Returns
self

toCarbon()#

public function toCarbon(DateTimeZone|string|null $timezone = null): CarbonImmutable
ParameterTypeDescription
$timezoneDateTimeZone|string|null = null
Returns
Carbon\CarbonImmutable

today()#

public static function today(DateTimeZone|string|null $timezone = null): self

static

ParameterTypeDescription
$timezoneDateTimeZone|string|null = null
Returns
self

toFormat102()#

public function toFormat102(): string

Date in UN/CEFACT format 102 (CCYYMMDD).

Returns
string

toIsoString()#

public function toIsoString(): string
Returns
string

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.