add Date_default_timezone_set (' PRC ') to the top page of the page; /*set the 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 sufficient 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-hour hour, from "01" to "12"H: 24-hour hour, from "00" to "23"g: 12 hour, not 0; from "1" to "12"G: 24 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 digit y:year, two digits Z: The day of the year;"1" to "366" ==================================================================1, year-month-the day indicates that the year can be in uppercase Y and lowercase y, indicating that the month can be in 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. EchoDate(' Y-m-j ');2007-02-6EchoDate(' Y-n-j ');07-2-6uppercase Y represents the year four digits, while lowercase y represents the two digits of the year, the lowercase m represents the number of the month (with the leading), and the lowercase n indicates the month number without leading. EchoDate(' Y-m-j ');2007-feb-6EchoDate(' y-m-d ');2007-02-06The uppercase M represents the 3 abbreviation characters of the month, while the lowercase m represents the number of the month (with leading 0); J with no upper case, only lowercase J for the date of the month, no leading o, or lowercase D if the month with leading is required. EchoDate(' Y-m-j ');2007-feb-6EchoDate(' Y-f-js ');2007-february-The 6th Capital M represents the 3 abbreviated characters of the month, while the 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, When: minute:seconds by default, the PHP interpretation is displayed as "Greenwich Mean Time", which differs from our local time by 8 hours. EchoDate(' G:i:s a ');5:56:57amEchoDate(' H:i:s A ');05:56:57am Lowercase g denotes 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". EchoDate(' G:i:s ');14:02:26The uppercase G represents the 24-hour hour, but without the preamble, and the uppercase H indicates a summary of the 24-hour hours with the preamble: the letter G means the hour without leading, the letter H represents the hour with the preamble, the lowercase g, h for the 12-hour system, and the uppercase G and H for the 24-hour system. 3, Leap year, week, dayEchoDate(' L '); This year whether it is leap years:0EchoDate(' l '); today is: TuesdayEchoDate(' D '); today is: Tue Capital L Indicates whether a leap year is to be judged, Boolean, true return 1, otherwise 0; lowercase l indicates the day of the week is the English full write (Tuesday), and the use of uppercase D is the 3 character abbreviation (Tue) of the days of the week. EchoDate(' W '); today's Week:2EchoDate(' W 'this week is the first in a year06The week lowercase w represents the day of the week, and the number form represents the number of days of the week in uppercase WEchoDate(' t '); This month is28daysEchoDate(' Z '); Today is the first of the year36Day Lowercase t indicates the current month and how many days lowercase Z means today is the day of the year4, the otherEchoDate(' T '); UTC Capital T indicates the server's time zone settingEchoDate(' I ');0uppercase I indicates whether the current is daylight saving time, returns 1 for true, otherwise 0EchoDate(' U ');1170769424The 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. EchoDate(' C ');2007-02-06t14:24:43+00:00lowercase C represents the ISO8601 date, and the date format is yyyy-MM-DD, using the letter T to interval the date and time, the time format is hh:mm:SS, the time zone is expressed using Greenwich Mean Time (GMT) deviation. EchoDate(' R '); Tue, Feb 2007 14:25:52 +0000The lowercase R represents the RFC822 date. 5, Format timeEcho$row["T_time"]; Will output 2008-2-29 12:08:00EchoDate("Y-m-d",Strtotime($row["T_time"]); Will output 2008-2-29Note that because$row["T_time"] gets 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 PHP date function parameters, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.