Home >Backend Development >PHP Tutorial >PHP Date Knowledge_PHP Tutorial
(1)date
Usage: date(format,[time]);
If there is no time parameter, the current time is used. The format is a string, in which the following characters have special meanings:
U is replaced by the number of seconds since a starting time (like January 1, 1970)
Y is replaced with a 4-digit year number.
y is replaced with a 2-digit year number.
F is replaced with the full English name of the month.
M is replaced with the English abbreviation of the month.
m Replace with the number of months.
z Replace with the number of days since January 1 of the current year.
d Replace with the number of days.
l Replace with the full English name of the day of the week.
D Replace with the day of the week English abbreviation.
w is replaced with the day of the week (number).
H is replaced with the number of hours (24-hour format).
h is replaced with the number of hours (12-hour format).
i is replaced with minutes. Number.
s is replaced with seconds.
A is replaced with "AM" or "PM".
a is replaced with "am" or "pm".
S is replaced with ordinal suffix, for example :"st","nd","rd","th".
(2)PHP method to calculate the difference between two times