Method 1
- echo Date ("y-m-d h:i:s");
Method 2
- Date_default_timezone_set (' asia/chongqing '); System time Difference 8-hour problem
- $now = getdate (Time ());
- $cur _wday= $now [' wday '];
- $date = Date ("y-m-d h:i:s $cweekday [$cur _wday]");
- Echo $date;
- by bbs.it-home.org
- ?>
Copy CodeThe meaning of the letter in the date function: A-"AM" or "PM" A-"AM" or "PM" B-swatch Internet time D-the day ordinal of the month with a leading zero 2-digit number, for example "" "to" D "-the first of the week Day, text representation, 3 letters, such as "Fri" F-month, full text format, such as "January" G-hour, 12-hour format, no leading zeros, such as "1" to "three" G-hour, 24-hour format, no leading zeros, e.g. "0" to "H" -Hours, 12-hour format, such as "01" to "a" H-hour, 24-hour format, such as "00" to "" I-minute, such as "00" to "I" (uppercase letters of "I")-if daylight saving time is "1", otherwise "0" J-month The day of the week, there is no leading zeros, such as "1" to "+" L (lowercase letters of "L")-the days of the day, the full text format, such as "Friday" L-Boolean indicates whether it is a leap year, such as "0" or "1" m-month, for example "" to "M- month, text representation, 3 letters, such as "Jan" N-month, no leading zeros, such as "1" to "O"-hours of difference from Greenwich Mean time, such as "+0200" R-RFC 822 format date, for example "Thu, Dec 2000 16:0 1:07 +0200 "(New in PHP 4.0.4) s-seconds, e.g." 00 "to" s "-English suffix after the number of days per month, 2 characters such as" St "," nd "," rd "or" th "T-the number of days for a given month, e.g." 28 "to" 3 1 "T-natively is in a time zone, such as" EST "or" MDT "(" Translator note "is in full text format under Windows, such as" Eastern Standard Time ", Chinese version will show" Chinese standards ".) U-The number of seconds since the beginning of the Unix era (January 1 1970 00:00:00 GMT) W-the Day of the week, numbers indicate, for example, "0" (Sunday) to "6" (Saturday) the week of the w-iso-8601 format year, weekly Starting from Monday (PHP 4.1.0 New) y-year, 4 digits, e.g. "1999" Y-Annual fee, 2 digits, such as the number of seconds for the "Z-offset" (for example, "43200" to "43200"). The time zone offset in the west of UTC is always negative, and the time zone offset to the east of UTC is always positive. |