后端日期与时间戳互相转换
$time = time(); //获取当前时间戳
$date = date('Y-m-d H:i:s',time()); //时间戳转换为日期格式
dump(strtotime($date)); //日期格式转换为当前的时间戳
前端页面时间戳转换日期
{$date|date="Y-m-d",###}
获取时间
加上"h:i:s"为当前日期,不加为当日凌晨
date('Y-m-d H:i:s', 1585356887); //当前日期2020-03-28 08:54:47
strtotime(date('Y-m-d'));//今天零点的时间戳
date('Y-m-d', strtotime('+1 day'));//明天的日期:2020-03-29
strtotime(date('Y-m-d', strtotime('+1 day')));//明天的零点的时间戳
date('Y-m-d', strtotime('+2 day'));//后天的日期:2020-03-30
strtotime(date('Y-m-d', strtotime('+2 day')));//后天的零点的时间戳
strtotime(date('Y-m-d H:i:s')); //H大写为24小时制
strtotime(date('Y-m-d h:i:s')); //h小写表示12小时制
获取某年某月某日
strtotime('+1 day');//一天后的今天
strtotime('+1 week');//一周后的今天
strtotime('+1 month');//一月后的今天
strtotime('+1 year');//一年后的今天