$field->toDate()
Converts the field value to a timestamp or a formatted date
Parameters
Name | Type | Default | Description |
---|---|---|---|
$format | string |IntlDateFormatter |null |
null |
PHP date formatting string |
$fallback | string |
null |
Fallback string for strtotime (since 3.2) |
Return type
string
|int
Examples
To a Unix timestamp
To a formatted date string
With fallback parameter
Check out PHP's date function docs for all available formatting options: https://www.php.net/manual/en/function.date.php.
If you use the strftime
date handler, the format syntax is different: https://www.php.net/manual/en/function.strftime.php.