now.php
Table of Contents
Functions
- now() : string
- Returns the current date/time as a formatted string.
Functions
now()
Returns the current date/time as a formatted string.
now([string $timezone = 'UTC' ][, string|null $format = DateFormat::DEFAULT ]) : string
The $timezone parameter is used only to interpret the "now" value. Since the default
format ends on a literal Z, the ISO-8601 designator for UTC, the result is converted to
UTC whichever timezone is asked for — see formatDateTime() for the full rule.
Parameters
- $timezone : string = 'UTC'
-
The timezone identifier (e.g., 'Europe/Paris'). Defaults to 'UTC'.
- $format : string|null = DateFormat::DEFAULT
-
The date format string compatible with DateTime::format(). Defaults to DateFormat::DEFAULT (ISO 8601 UTC with milliseconds).
Tags
Return values
string —The formatted current date/time string.