PHP » GoLang |
login |
register |
about
|
date(PHP 4, PHP 5, PHP 7) date — Format a local time/date Description
string date
( string
$format
[, int $timestamp = time()
] )
Returns a string formatted according to the given format string using the
given integer Parameters
Return Values
Returns a formatted date string. If a non-numeric value is used for
Errors/Exceptions
Every call to a date/time function will generate a Changelog
Examples
Example #1 date() examples
<?php 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()
<?php It is possible to use date() and mktime() together to find dates in the future or the past. Example #3 date() and mktime() example
<?php
Some examples of date() formatting. Note that you should escape any other characters, as any which currently have a special meaning will produce undesirable results, and other characters may be assigned meaning in future PHP versions. When escaping, be sure to use single quotes to prevent characters like \n from becoming newlines. Example #4 date() Formatting
<?php To format dates in other languages, you should use the setlocale() and strftime() functions instead of date(). Notes
Tip
Timestamp of the start of the request is available in $_SERVER['REQUEST_TIME'] since PHP 5.1. See Also
|
more
Recently updated
more
Most requested
more
Last requests
|