Explanation of PHP date and time functions date ()

Source: Internet
Author: User
PHP date and time functions date () 1, year-month-day echodate (& #39; Y-m-j & #39;); 2007-02-6echodate (& #39; y-n-j & #39;); 07-2-6 uppercase Y indicates four digits of the year, while lowercase y indicates two digits of the year. lowercase m indicates the number of the month (with the leading digit ), n in lower case indicates no... "/> <scriptty PHP date and time function date () 1, year-month-day echo date ('Y-m-J '); echo date ('Y-n-J'); 07-2-6 uppercase y indicates four digits of the year, while lowercase Y indicates two digits of the year; lowercase m indicates the number of the month (with the leading digit), while lowercase n indicates the number of the month without the leading digit. Echo date ('Y-M-J'); 2007-Feb-6 echo date ('Y-m-D'); 2007-2-06 upper case M indicates three abbreviations of the month, in lower case, m indicates the number of the month (with the leading 0); in less Case, J indicates the date of the month, and no leading o; use lowercase d if the month has a prefix. Echo date ('Y-M-J'); 2007-Feb-6 echo date ('Y-F-js'); 2007-February-6th Capital M represents three abbreviations of the month, in upper case, F indicates the English full write of the month. (No lowercase f) uppercase S indicates the suffix of the date, such as "st", "nd", "rd", and "th". for details, see the date number. Summary: The year can be uppercase Y and lowercase y; the month can be uppercase F, uppercase M, lowercase m, and lowercase n (two types of characters and numbers respectively ); indicates the date suffix. 2, hour: minute: by default, PHP interprets the display time as "Greenwich Mean Time", which is 8 hours different from our local time. Echo date ('G: I: s a'); 5:56:57 am echo date ('H: I: s a'); 05:56:57 AM lowercase g indicates 12-hour format, no leading 0, while lowercase h indicates a 12-hour system with leading 0. When the 12-hour format is used, it indicates that upper afternoon, lower case a indicates lower case "am" and "pm", and upper case A indicates upper case "AM" and "PM ". Echo date ('G: I: s'); 14:02:26 uppercase G indicates the number of hours in the 24-hour system, but without leading; use uppercase H to indicate the number of hours in the 24-hour format with the leading character. the Letter g indicates that the hour does not have the leading character, and the letter h indicates that the hour has the leading character. the lowercase g and h indicate that the 12-hour format, uppercase G and H indicate the 24-hour format. 3. leap year, week, and day echo date ('L'); this year's leap year: 0 echo date ('L'); today is: Tuesday echo date ('D '); today is: Tue capital L indicates whether to determine the leap year of the year, Boolean value, true returns 1; otherwise, 0; lowercase l indicates the day of the week in full (Tuesday ); however, uppercase D is used to represent the three abbreviation of the day of the week (Tue ). Echo date ('w'); today's week: 2 echo date ('w'); this week is the first week of the year. lowercase w indicates the day of the week, in the digit format, W indicates the number of weeks in a year. echo date ('t'); this month is 28 days echo date ('Z '); today is the second day of this year. lowercase t indicates the number of days in the current month. lowercase z indicates that today is the fourth day of this year. Other echo date ('t '); UTC capital T indicates that echo date ('I') is set for the time zone of the server; 0 capital I indicates that 1 is returned if the current value is success, otherwise, the value is 0 echo date ('u'). The value 1170769424 indicates the total number of seconds from January 1, January 1, 1970 to the present, which is the Unix timestamp of 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, with the letter T to separate the date and time, the time format is HH: MM: SS, and the time zone is expressed by GMT deviation. Echo date ('r'); Tue, 06 Feb 2007 14:25:52 + 0000 lowercase r indicates the RFC822 date.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.