久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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怎么算兩個時間中差幾天

      方法:1、利用strtotime()函數(shù)將兩個指定的時間格式化為時間戳,語法為“strtotime(指定時間)”;2、將兩個時間戳相減,獲取兩個時間秒數(shù)的時間差;3、將秒數(shù)的時間差轉(zhuǎn)換為天數(shù)的時間差即可,語法為“秒數(shù)的時間差/86400”。

      php怎么算兩個時間中差幾天

      本文操作環(huán)境:Windows10系統(tǒng)、PHP7.1版、Dell G3電腦

      php怎么算兩個時間中差幾天

      1、利用strtotime函數(shù)將時間格式化為時間戳

      strtotime() 函數(shù)將任何英文文本的日期或時間描述解析為 Unix 時間戳(自 January 1 1970 00:00:00 GMT 起的秒數(shù))。

      語法為:

      strtotime('年-月-日 時:分:秒')

      示例如下:

      <?php  echo(strtotime('2022-04-13 12:25:00'));  ?>

      輸出結(jié)果:

      php怎么算兩個時間中差幾天

      2、將兩個時間戳相減,獲取兩個時間的時間差

      3、將獲取的時間差除以86400就是兩個時間相差的天數(shù)

      示例如下:

      <?php  $time1=strtotime('2022-04-13 12:25:00');  $time2=strtotime('2022-04-15 12:25:00');  $diff_seconds = $time2 - $time1; $diff_days = $diff_seconds/86400; echo($diff_days . "天"); ?>

      輸出結(jié)果:

      php怎么算兩個時間中差幾天

      推薦學(xué)習(xí):《PHP視頻教程》

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