Check if timestamp is today

后端 未结 7 952
傲寒
傲寒 2020-12-29 19:28

I\'ve got a timestamp in the following format (Which can easily be changed thanks to the beauties of PHP!).

2011-02-12 14:44:00

7条回答
  •  情歌与酒
    2020-12-29 19:50

    $offset = date('Z'); //timezone offset in seconds
    
    if (floor(($UNIX_TIMESTAMP + $offset) / 86400) == floor((mktime(0,0,0) + $offset) / 86400)){
        echo "today";
    }
    

提交回复
热议问题