How to use the PHP date () function
Today, I would like to share with you the relevant knowledge points about how to use the PHP date () function. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
PHP date () function
The PHP date () function formats the timestamp into a more readable date and time.
A timestamp is a sequence of characters that indicates the date / time of a given event.
The syntax string date (string $format [, int $timestamp]) parameter describes that format is required. Specifies the format of the timestamp. Timestamp is optional. Specify a time stamp. The default is the current date and time. PHP Date ()-format date
The first required parameter of the date () function, format, specifies how the date / time is formatted.
Here are some available characters:
D-represents the day of the month (01-31)
M-represents month (01-12)
Y-represents year (four digits)
For a list of all the characters available in the format parameter, please refer to our PHP Date reference manual, the date () function.
You can insert other characters between letters, such as "/", "." Or "-", so you can add additional formats:
The output of the above code is as follows:
2016Accord 212016.10.212016-10-21 and above are all the contents of this article entitled "how to use the PHP date () function". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.