PHP Date Function Base,datebase_PHP教程

來源:互聯網
上載者:User

PHP Date Function Base,datebase


/**************格式中可使用字母的含義**************/
a – "am" 或是 "pm" A – "AM" 或是 "PM" d – 幾日,二位元字,若不足二位則前面補零; 如: "01" 至 "31" D – 星期幾,三個英文字母; 如: "Fri" F – 月份,英文全名; 如: "January" h – 12 小時制的小時; 如: "01" 至 "12" H – 24 小時制的小時; 如: "00" 至 "23" g – 12 小時制的小時,不足二位不補零; 如: "1" 至 12" G – 24 小時制的小時,不足二位不補零; 如: "0" 至 "23" i – 分鐘; 如: "00" 至 "59" j – 幾日,二位元字,若不足二位不補零; 如: "1" 至 "31" l – 星期幾,英文全名; 如: "Friday"L- get 閏年 return 1 else return 0 m – 月份,二位元字,若不足二位則在前面補零; 如: "01" 至 "12" n – 月份,二位元字,若不足二位則不補零; 如: "1" 至 "12" M – 月份,三個英文字母; 如: "Jan" s – 秒; 如: "00" 至 "59" S – 字尾加英文序數,二個英文字母; 如: "th","nd" t – 指定月份的天數; 如: "28" 至 "31" U – 總秒數 w – 數字型的星期幾,如: "0" (星期日) 至 "6" (星期六) Y – 年,四位元字; 如: "1999" y – 年,二位元字; 如: "99" z – 一年中的第幾天; 如: "0" 至 "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=PRC echo date('Y-m-d h:i A');             --->output: 2015-4-7 10:10 AM Changed2.strtotime(char_date[,int $now]); The date string conversion unix echo 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-103.gmdate(char_date_mode,unix);    The unix conversion date string  echo gmdate("Y-m-d",1428336000);      --->output:2015-04-064.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 PM5.checkdate(m,d,y);   checking data time
echo checkdate(13,10,2016) ? "True":"False";    --->output: Falseecho checkdate(12,10,2016) ? "True":"False";    --->output: True6.getdate(unix)     return date array print_r(getdate(time());Array ( [seconds] => 37 [minutes] => 10 [hours] => 16 [mday] => 7 [wday] => 2 [mon] => 4 [year] => 2015 [yday] => 96 [weekday] => Tuesday [month] => April [0] => 1428394237 )

http://www.bkjia.com/PHPjc/980032.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/980032.htmlTechArticlePHP Date Function Base,datebase /**************格式中可使用字母的含義**************/ a "am" 或是 "pm"A "AM" 或是 "PM"d 幾日,二位元字,若不足二位則前面...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.