Php date
- current date function in php
- which function used to return current date in php
- function current-date
- date function in php
Php date to string.
Strtotime in phpdate
(PHP 4, PHP 5, PHP 7, PHP 8)
date — Format a Unix timestamp
Parameters
Format accepted by DateTimeInterface::format().
Note: date() will always generate as microseconds since it takes an int parameter, whereas DateTimeInterface::format() does support microseconds if an object of type DateTimeInterface was created with microseconds.
The optional parameter is an int Unix timestamp that defaults to the current local time if is omitted or . In other words, it defaults to the value of time().
Return Values
Returns a formatted date string.
Current time in php
Changelog
Version | Description |
---|---|
8.0.0 | is nullable now. |
Examples
Example #1 date() examples
You can prevent a recognized character in the format string from being expanded by escaping it with a preceding backslash.
If the character with a backslash is already a special sequence, you may need to also escape the backslash.
Example #2 Escaping characters in date()
It is possible to use date() and mktime() together to find dates in the future or the past.
Example #3 d
- current date and time in php