Php format the date and php format the date

Source: Internet
Author: User

Php format the date and php format the date

Php format the date

Function ShowDate ($ flag = 0, $ timestr = NULL) {// obtain the number of weeks $ warr = array ("0" => Sunday, "1" => Monday, "2" => Tuesday, "3" => Wednesday, "4" => Thursday, "5" => Friday, "6" => Saturday ); $ I = date ("w", $ timeStamp); // Set Beijing time and obtain the timeStamp date_default_timezone_set ('prc'); $ timeStamp = NULL; if ($ timestr) $ timeStamp = strtotime ($ timestr); else $ timeStamp = time (); // set the time display format $ ret1 = date ("Y, m, D, H: m: s ", $ timeStamp ). "". $ warr [$ I]; $ ret2 = date ("Y-m-d H: m: s", $ timeStamp ). "". $ warr [$ I]; $ ret3 = date ("y/m/d", $ timeStamp); $ ret = $ ret1; // The first if ($ flag = 2) $ ret = $ ret2; else if ($ flag = 3) $ ret = $ ret3; return $ ret;} is returned by default ;}

Http://php.662p.com/thread-488-1-1.html

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.