PHP's date() function is used to format time or date. PHP Date() Function The PHP Date() function formats a timestamp into a more readable date and time. grammar
date(format,timestamp)
parameter
describe
format
Required. Specifies the format of the timestamp.
timestamp
Optional. Specify timestamp. The default is the current date and time.
PHP
date
-
What is a timestamp (
Timestamp
)?
Timestamp is since
1970
Year
1
moon
1st (
00:00:00 GMT
) the number of seconds since. It is also known as
Unix
Timestamp (
Unix
Timestam
).
PHP
date
- Format date
date()
The first parameter of the function specifies how to format the date/
time. It uses letters to represent date and time formats. Listed here
Some available letters:
d -
Day in the month
(01-31)
m - the current month as a number
(01-12)
Y - Current year (four digits)
You can find it in our
PHP Date
Refer to the manual to find all the letters that can be used in the format parameters.
You can insert other characters between letters, such as
"/"
,
"."
or
"-"
, so that additional formats can be added:
<?php echo date("Y/m/d"); echo "<br />"; echo date("Y.m.d"); echo "<br />";
Statement:
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn