Skip to content

Kirby 4.2.0

$date->toString()

Returns the date, time or datetime in YYYY-MM-DD hh:mm:ss format with optional timezone

$date->toString(string $mode = 'datetime', bool $timezone = true): string

Parameters

Name Type Default Description
$mode string 'datetime' date, time or datetime
$timezone bool true Whether the timezone is printed as well

Return type

string

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException If the mode is invalid

Parent class

Kirby\Toolkit\Date