On the top page of the page, add
Date_default_timezone_set (PRC); /* Transfer time to Beijing time, php5 default to Greenwich Mean Time */
Date ()
A: "AM" or "PM"
A: "AM" or "PM"
D: A few days, two digits, if insufficient 0; from "01" to "31"
D: Day of the week, 3 English letters, such as: "Fri"
F: Month, English full name, such as: "January"
H:12 hours, from "01" to "12"
H: 24-hour hour, from "00" to "23"
G:12 hours of the hour, not 0; from "1" to "12"
G: 24-hour hour, not 0; from "0" to "23"
J: Few days, not enough to be 0; from "1" to "31"
L: Day of the week, English full name, such as: "Friday"
M: month, two digits, from "01" to "12"
N: month, two digits, not 0; from "1" to "12"
M: Month, 3 English letters, e.g.: "Jan"
s: seconds; from "00" to "59"
S: English ordinal number, two English letters, such as: "21th"
T: Specify the number of days of the month, from "28" to "31"
U: Total number of seconds
W: Number of days of the week, from "0 (Sunday)" to "6 (Saturday)"
Y: Year, four digits
Y: Year, two digits
Z: The day of the Year; from "1" to "366"
==================================================================
1, year-month-day
Indicates that the year can be in uppercase Y and lowercase y;
Indicates that the month can be in uppercase F, uppercase M, lowercase m, and lowercase n (two ways of representing characters and numbers, respectively);
Indicates that the day can be in lowercase d and lowercase j, and uppercase s represents the suffix of the date.
echo Date (' y-m-j ');
2007-02-6
echo Date (' y-n-j ');
07-2-6
Uppercase Y represents the year four digits, while lowercase y represents the two digits of the year;
Lowercase m represents the number of months (with leading), while lowercase n indicates no leading month number.
echo Date (' y-m-j ');
2007-feb-6
echo Date (' y-m-d ');
2007-02-06
The uppercase M represents the 3 abbreviated characters of the month, while the lowercase m represents the number of the month (with leading 0);
J with no uppercase, only lowercase J indicates the date of the month, no leading o, or lowercase D if a month with a leading is required.
echo Date (' y-m-j ');
2007-feb-6
echo Date (' Y-f-js ');
2007-february-6th
Uppercase M represents the 3 abbreviated characters of the month, while uppercase F indicates the full written English of the month. (No lowercase f)
Uppercase S represents the suffix of the date, such as "St", "nd", "rd", and "th", depending on the date number.
2, Hours: minutes: seconds
By default, the PHP interpretation is displayed as "Greenwich Mean Time", which differs from our local time by 8 hours.
echo Date (' g:i:s a ');
5:56:57 am
echo Date (' H:i:s A ');
05:56:57 AM
The lowercase g represents a 12-hour system without a leading 0, while the lowercase h indicates a 12-hour system with a leading 0.
When using the 12-hour system, it is necessary to indicate that in the afternoon, lowercase a represents the lowercase "am" and "PM", and uppercase a denotes uppercase "AM" and "PM".
echo Date (' g:i:s ');
14:02:26
Uppercase G denotes 24-hour hours, but without preamble, and uppercase H for leading 24-hour hours
Summary:
The letter g means the hour without leading, the letter H denotes the hour with the preamble;
lowercase g, h for 12-hour system, uppercase G, h for 24-hour system.
3, Leap year, week, day
echo Date (' L ');
Leap Year: 0
echo Date (' L ');
Today is: Tuesday
echo Date (' D ');
Today is: Tue
Uppercase L Indicates whether this year is a leap years, a Boolean value that returns 1 for true, otherwise 0;
Lowercase L Indicates the day of the week in English full write (Tuesday);
Instead, use uppercase D to denote the 3-character abbreviation (TUE) of the day of the week.
echo Date (' W ');
Today's Week: 2
echo Date (' W ');
This week is the No. 06 week of the year.
The lowercase w represents the day of the week, and the numeric representation
Uppercase W indicates the number of weeks in a year
echo Date (' t ');
This month is 28 days
echo Date (' Z ');
Today is the 36th day of the year.
Lowercase t indicates the current month and how many days
Lowercase z indicates that today is the first day of the year
4, other
echo Date (' T ');
Utc
Capital T indicates the server's time zone setting
echo Date (' I ');
0
Uppercase I indicates whether the current is daylight saving time, returns 1 for true, otherwise 0
echo Date (' U ');
1170769424
The capital U represents the total number of seconds from January 1, 1970 to the present, which is the UNIX timestamp for the Unix time era.
echo Date (' C ');
2007-02-06t14:24:43+00:00
Lowercase C represents the ISO8601 date, the date format is YYYY-MM-DD, the letter T is used to interval the date and time, the time format is HH:MM:SS, and the time zone is represented by the deviation of Greenwich Mean Time (GMT).
echo Date (' R ');
Tue, Feb 2007 14:25:52 +0000
The lowercase R represents the RFC822 date.
5, the format of time
echo $row ["T_time"]; Will output 2008-2-29 12:08:00
echo Date ("Y-m-d", Strtotime ($row ["t_time"]); Will output 2008-2-29
Note, because $row["T_time"] the time is already a string, so need to use Strtotime (string to timestamp) to turn, or output 1970-01-01 error
The above describes the disk error press any key to re PHP in the date function parameter collation, including the disk error press any key to re aspects, I hope to be interested in PHP tutorial friends helpful.