date
Formats a local date and time according to the specified format string.
Parameters
main.php
Return Values
string
Returns a formatted date string
On success:Formatted date string based on the format parameter
On failure:Warning is generated if timezone is not valid
Notes
- Uses local time zone unless explicitly set with date_default_timezone_set()
- If timestamp is null or omitted, current time is used
- Format characters are case-sensitive and have specific meanings
- Use backslash to escape format characters that should be literal
Changelog
- 8.0.0: timestamp is now nullable
Related Functions
time
Date/TimeReturns the current Unix timestamp (number of seconds since January 1, 1970 00:00:00 GMT).
timestamptimeunix
number_format
StringFormats a number with grouped thousands and customizable decimal/thousand separators.
formatdisplaycurrency