PHP Date-time function _php Tutorial

Source: Internet
Author: User
Tags echo date local time
PHP datetime function Date () 1, year-month-day echo date (' Y-m-j '), 2007-02-6 echo date (' Y-n-j '), 07-2-6 uppercase Y for year four digits, and lowercase y for year two digits, and lowercase m for month numbers ( With a leading), while lowercase n indicates a month number without a leading. echo Date (' Y-m-j '), 2007-feb-6 echo date (' y-m-d '); 2007-02-06 uppercase M represents the 3 abbreviation of the month, while lowercase m represents the number of the month (with leading 0); J with no caps, only lowercase J indicates 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-6 echo date (' Y-f-js '), 2007-february-6th capital M for the 3 abbreviation of the month, and uppercase F for full-text 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. Summary: Indicates that the year can be capitalized with 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. 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 am echo 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 leap years: 0 echo date (' L '); today is: Tuesday Echo date (' D '); today is: Tue Capital L Indicates whether a leap year, Boolean value, returns 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: 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 number form indicates that the uppercase W represents the number of weeks of the year echo date (' t '); this month is the 28-days echo date (' Z '); 36 Day Lowercase T indicates the current month and how many days lowercase Z means that today is the day of the Year 4, other echo date (' T '); The UTC Capital T indicates the server's time zone setting, echo date (' I '), 0 uppercase I to determine whether the current is daylight savings, 1 for true, otherwise 0 echo date (' U '), and 1170769424 capital U for 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 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 uses Greenwich Mean Time ( GMT) is indicated by the deviation. echo Date (' R '); Tue, Feb 2007 14:25:52 +0000 lowercase R represents the RFC822 date.

http://www.bkjia.com/PHPjc/477675.html www.bkjia.com true http://www.bkjia.com/PHPjc/477675.html techarticle php datetime function Date () 1, year-month-day echo date (y-m-j), 2007-02-6 echo Date (y-n-j), 07-2-6 uppercase Y for year four digits, and lowercase y for year two digits; lowercase m for month ...

  • Related Article

    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.