久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php中與時間相關(guān)的常用函數(shù)有哪些

      php中與時間相關(guān)的常用函數(shù)有哪些

      php中與時間相關(guān)的常用函數(shù)有:date_default_timezone_set()、date_create()、date_diff()、date_timestamp_get()、strtotime()、microtime()。下面我們通過代碼來一一介紹。

      代碼示例:

      <?php /**  * 設(shè)置時區(qū)  */ date_default_timezone_set("Asia/Shanghai");   /**  * 獲取時區(qū)  */ echo date_default_timezone_get(); //結(jié)果 UTC echo "<br/>";   /**  * 添加時間  */ $date=date_create("2013-03-15"); //創(chuàng)建一個DateTime 對象 date_add($date,date_interval_create_from_date_string("40 month"));//years days //date_interval_create_from_date_string 從字符串的相關(guān)部分建立一個DateInterval。 echo date_format($date,"Y-m-d"); //結(jié)果2016-07-15 echo "<br/>";   /**  * 減去時間  */ $date=date_create("2013-03-15"); date_sub($date,date_interval_create_from_date_string("40 days")); echo date_format($date,"Y-m-d"); //2013-02-03 echo "<br/>";   /**  * 獲取兩個時區(qū)的差值  */ $date1=date_create("2013-03-15"); $date2=date_create("2013-12-12"); $diff=date_diff($date1,$date2);//返回的是一個DateInterval對象 echo "<pre>"; var_dump($diff); // object(DateInterval)#4 (15) { //  ["y"]=> //  int(0) //  ["m"]=> //  int(8) //  ["d"]=> //  int(27) //  ["h"]=> //  int(0) //  ["i"]=> //  int(0) //  ["s"]=> //  int(0) //  ["weekday"]=> //  int(0) //  ["weekday_behavior"]=> //  int(0) //  ["first_last_day_of"]=> //  int(0) //  ["invert"]=> //  int(0) //  ["days"]=> //  int(272) //  ["special_type"]=> //  int(0) //  ["special_amount"]=> //  int(0) //  ["have_weekday_relative"]=> //  int(0) //  ["have_special_relative"]=> //  int(0) // } echo "<br/>";   /**  * 獲取當(dāng)前時間戳  */ $date=date_create(); echo date_timestamp_get($date) .'<br/>';   $time = time(); echo $time .'<br>';   echo strtotime("now") .'<br/>';   /*  *獲取今天0點時間戳  */   echo strtotime("today").'<br>'; /**  * 獲取帶微秒的時間  */ echo microtime(true);   /*  *獲取指定時間戳   * mktime(hour,minute,second,month,day,year);  */ echo "<br/>"; echo mktime(18,30,15,3,15,2019);   /*  *獲取前一天0點時間戳  */ echo "<br/>"; echo strtotime('yesterday');   /*  *獲取昨天此時的時間戳  */ echo "<br/>";   echo strtotime('-1 days');   ?>

      運行結(jié)果:

      Asia/Shanghai 2016-07-15 2013-02-03 object(DateInterval)#4 (15) {   ["y"]=>   int(0)   ["m"]=>   int(8)   ["d"]=>   int(27)   ["h"]=>   int(0)   ["i"]=>   int(0)   ["s"]=>   int(0)   ["weekday"]=>   int(0)   ["weekday_behavior"]=>   int(0)   ["first_last_day_of"]=>   int(0)   ["invert"]=>   int(0)   ["days"]=>   int(272)   ["special_type"]=>   int(0)   ["special_amount"]=>   int(0)   ["have_weekday_relative"]=>   int(0)   ["have_special_relative"]=>   int(0) } 1591150859 1591150859 1591150859 1591113600 1591150859.0074 1552645815 1591027200 1591064459

      如果您想了解

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號