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 not enough to fill 0; from "01" to "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" a "H: 24-hour hours, from" 00 "to" g:12 "hours of the hour, do not fill 0; from" 1 "to" G: 24-hour small , do not fill 0; from "0" to "four" J: a few days, insufficient not to be 0; from "1" to "D" L: Day of the week, English full name, such as: "Friday" M: month, two digits, from "01" to "three" N: month, two digits, not 0; from "1" to "M": Month, 3 English letters, such as: "Jan" s: seconds, from "00" to "the" s: the end of the English ordinal, two English letters, such as: "21th" T: Specify the number of days of the month, from "28" to "X" U: Total seconds W: number of day 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 capitalized in Y and lowercase y, indicating that the month can be capitalized with uppercase F, uppercase M, lowercase m, and lowercase n (two ways of representing characters and numbers, respectively); 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-6echo date (' Y-n-j '), 07-2-6 uppercase Y for year four digits, and lowercase y for two digits of the year, lowercase m for the month number (with leading), and lowercase n for no leading month number. echo Date (' Y-m-j '), 2007-feb-6echo date (' y-m-d '); 2007-02-06 uppercase M represents the 3 abbreviated characters of the month, while lowercase m represents the number of the month (with leading 0); J with no caps, only lowercase J for the date of the month. No leading o; Use lowercase d if you need a month with a leading. echo Date (' y-m-j '); 2007-feb-6echo date (' Y-f-js '), 2007-february-6th capital M represents the 3 abbreviated characters of the month, and uppercase F indicates the full written English of the month. (no lowercase f) uppercase S denotes the suffix of the date, such as "St", "nd", "rd", and "th", depending on the date number. 2, hour: minute: Seconds by default, the PHP explanation shows the time "Greenwich Mean Time", which differs from our local time by 8 hours. echo Date (' g:i:s a '); 5:56:57 amecho date (' h:i:s a '); 05:56:57 am lowercase g for 12-hour, no leading 0, and lowercase h for 12-hour with 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 a summary of 24-hour hours with leading: the letter G means the hour without leading, the letter H denotes the hour with the preamble, the lowercase g, h for the 12-hour system, Uppercase G, h indicates a 24-hour system. 3, Leap year, Day of the week, Days of Echo date (' L '); whether it is a leap years: 0echo date (' l '); today is: Tuesdayecho date (' D '); today is: Tue Capital L Indicates whether the year is a leap years, a Boolean value, a true return of 1, otherwise 0 Lowercase L Indicates the day of the week is written in English full (Tuesday), while uppercase D is used to denote the 3-character abbreviation (Tue) of the days of the week. echo Date (' W '); today's Week: 2echo date (' W '); This week is the No. 06 week of the year, the lowercase w represents the day of the week, and the number form indicates that the uppercase W represents the number of days of the Week echo date (' t '); this month is the Echo date 28 (' Z '); Today is the 36th day of the year lowercase T represents the current month and how many days lowercase Z represents today is the first day of the Year 4, other echo date (' T '); The UTC Capital T indicates the time zone setting of the server, echo date (' I '), the uppercase I to determine whether the current is daylight savings, the true return of 1, otherwise 0echo date (' U '), and the capital U represents the total number of seconds from January 1, 1970 to the present, is the Unix timestamp of the Unix time era. echo Date (' C '); 2007-02-06t14:24:43+00:00 lowercase c denotes ISO8601 date, date format is YYYY-MM-DD, date and time are separated by letter T, time format is HH:MM:SS, and time zone uses Greenwich standardThe deviation of the time (GMT) to indicate. echo Date (' R '); Tue, Feb 2007 14:25:52 +0000 lowercase R represents the RFC822 date. 5, the format of the time echo $row ["T_time"]; The output 2008-2-29 12:08:00echo date ("y-m-d", Strtotime ($row ["t_time"]); Will output 2008-2-29 note, due to $row["t_time"] to get the time is already a string, so need to use Strtotime (string to timestamp) to turn, or output 1970-01-01 error