维度c
论坛版主
论坛版主
  • 最后登录2017-03-29
  • 发帖数4
阅读:7724回复:0

[php]获取两个时间的时间戳差

楼主#
更多 发布于:2017-02-17 13:59
strtotime() 函数将任何英文文本的日期或时间描述解析为 Unix 时间戳(自 January 1 1970 00:00:00 GMT 起的秒数)。

                    class timestamp{
                            var $time_stamp;
                            function __construct($time1,$time2){
                                   $this->time_stamp = strtotime($time1) - strtotime($time2);
                            }
                            function gettimestamp(){
                                   return $this->time_stamp;
                            }
                     }
                     $time1="2016-11-24";
                     $time2="2016-11-23";
                     $a= new timestamp($time1,$time2);
                     echo $a->gettimestamp();
游客


返回顶部

公众号

公众号