常用的时间转换代码可以收藏哦
php  /  管理员 发布于 4年前   504
转时间戳:strtotime 我就不写了 今天:date("Y-m-d"); 昨天:date('Y-m-d',strtotime("-1 day")); 上月第一天:date('Y-m-01', strtotime('-1 month')); 上月最后一天:date('Y-m-t', strtotime('-1 month')); 当月第一天:date('Y-m-01', strtotime($time)); 当月最后一天:date('Y-m-d',strtotime(date('Y-m-01', strtotime($time)) + 1 month -1 day)); 4.使用函数及数组来获取当月第一天及最后一天,来自网络 function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day")); return array($firstday,$lastday); } $today = date("Y-m-d"); $day=getthemonth($today); echo "当月的第一天: ".$day[0]." 当月的最后一天: ".$day[1];
博主 在
hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令中评论 @路过的靓仔:cdn静态资源被墙,已修复..GGGGGGGGG 在
layui框架常用输入框介绍中评论 写的很好解决问题..路过的靓仔 在
hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令中评论 剩下好多 wait 状态的..激光豆芽 在
为什么你不能安逸?国内996为什么没有国外955香?中评论 国内现在无意义的内卷太多了..激光豆芽 在
阿里云香港服务器搭建自用vpn:Shadowsocks使用流程步骤中评论 厉害了..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号