$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
This method modifies the existing $date object it is applied to and returns it again.
Exceptions
| Type | Description |
|---|---|
Kirby\Exception\InvalidArgumentException |
If the mode is invalid |