PHP Date Function base,datebase_php Tutorial

Source: Internet
Author: User
Tags echo date

PHP Date Function Base,datebase


The meaning of letters can be used in the/************** format **************/
A – "AM" or "PM" A – "AM" or "PM" D – a few days, two digits, if less than two digits before 0; such as: "01" to "to" D – days, three English letters; such as: "Fri" F – month, English full name; such as: "January" h–12 Hours: "01" to " h–24 Hours: "00" to " all" g–12 hours, less than two digits not 0; For example: "1" to " g–24 hours, less than two digits do not fill 0, such as: "0" to " all"I – minutes; such as: "00" to "J –" A few days, two digits, if less than two does not fill 0; such as: "1" to "L –" Days of the week, English full name; such as: "Friday" L-get leap year return 1 else return 0 M – month, two digits, if less than two bits in front of 0; such as: "01" to "three" N – month, two digits, if less than two will not fill 0; such as: "1" to "a" m – month, three English letters; such as: "Jan" s-seconds; such as: "00" to "s-" with the English ordinal number, two English letters; such as: "th", "nd" T-the number of days of the specified month; such as: "28" to "U" the total number of seconds W – number of days, such as: "0" (Sunday) to "6" (Saturday) y – years, four digits; such as: "1999" Y – year, two digits; such as: "Z –" the first day of the year; such as: "0" to "365" 1.date (Char_date,unix);Current date:2015-4-7 10:10 amecho date (' y-m-d h:i A ');             --->output:2015-4-7 02:10 amecho date (' y-m-d h:i A '); --->output:2015-4-7 02:10 AM not Chang (1) date_default_timezone_set (' PRC '); PHP 5.1+ (2) php.ini Update DATE.TIEMZONE=PRCecho Date (' y-m-d h:i A '); --->output:2015-4-7 10:10 AM Changed 2.strtotime (Char_date[,int $now]); The date string conversion Unixecho strtotime (' 2015-4-7 ');      --->output:1428336000 timestampecho date (' y-m-d ', strtotime (' 2015-4-7 ');       --->output:2015-04-06echo date (' y-m-d ', Strtotime ("+3 Day");     --->output:2015-04-10echo date (' y-m-d ', Strtotime ("next year"); --->output:2016-04-10 3.gmdate (Char_date_mode,unix);     The UNIX conversion date stringEcho gmdate ("y-m-d", 1428336000); --->output:2015-04-06 4.mktime (h,i,s,m= "M", d= "D", y= "Y"); based on date return UNIXEcho gmdate ("y-m-d h:i:s A", Mktime (0,0,0, "8", "18", "2018")); --->output:2018-08-17 16:00:00 PM 5.checkdate (m,d,y);     Checking data time
echo checkdate (13,10,2016)?    "True": "False"; --->output:falseecho checkdate (12,10,2016)?    "True": "False"; --->output:true 6.getdate (Unix) return Date ArrayPrint_r (GETDATE (Time ()); Array ([seconds] = Panax Notoginseng [minutes] [hours] [wday] [Mday] [7] = 2 [Mon] = 4 [Year] = 20 [Yday] = [Weekday] = Tuesday [month] = April [0] = 1428394237)

http://www.bkjia.com/PHPjc/980032.html www.bkjia.com true http://www.bkjia.com/PHPjc/980032.html techarticle PHP Date Function base,datebase/************** format can use the meaning of the letter **************/a "AM" or "PM" a "AM" or "PM" D a few days, two digits, if less than two bits The front ...

  • 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.