获取时间戳或日期

//2019年1月15号执行的
var_dump(date('Y-m-d H:i:s',strtotime(date('Y-m-d 23:59:59', strtotime('last day this week')))+1));//获取本周第一天 输出:2019-01-14 00:00:00
var_dump(date('Y-m-d H:i:s',strtotime(date("Y-m-01"))));//获取本月第一天 输出:2019-01-01 00:00:00
var_dump(date('Y-m-d H:i:s',strtotime(date('Y-m-01', strtotime(date("Y-m-d")))."+1 month") -1));//获取本月最后一天最后一秒 输出:2019-01-31 23:59:59

猜你喜欢

转载自blog.csdn.net/samtrue/article/details/86489894
今日推荐