分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

php 根据当日时间,计算出本日,周,月,季,年,时间戳范围

发布时间:2023-09-06 02:01责任编辑:沈小雨关键词:时间戳
if( $type == 1) {//当天 ???????????$time[‘start‘] = mktime(0, 0, 0, date(‘m‘), date(‘d‘), date(‘y‘)); ???????????$time[‘end‘] = mktime(0, 0, 0, date(‘m‘), date(‘d‘) + 1, date(‘y‘))-1; ???????}else if($type==2){ ??????????//周 ??????????$time[‘start‘] ?= mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); ??????????$time[‘end‘] = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")); ??????????????????} else if($type==3){ ???????????//月 ???????????$time[‘start‘] = mktime(0, 0 , 0,date("m"),1,date("Y")); ???????????$time[‘end‘] = mktime(23,59,59,date("m"),date("t"),date("Y")); ???????}else if($type == 4){ ???????????//季度 ???????????$season = ceil((date(‘n‘))/3);//当月是第几季度 ???????????$time[‘start‘] = ?mktime(0, 0, 0,$season*3-3+1,1,date(‘Y‘)); ???????????$time[‘end‘] ?= mktime(23,59,59,$season*3,date(‘t‘,mktime(0, 0 , 0,$season*3,1,date("Y"))),date(‘Y‘)); ???????}else if($type == 5 ){ ???????????//年 ???????????$time[‘start‘] = ?mktime(0, 0, 0,1,1,date(‘Y‘)); ???????????$time[‘end‘] ?= mktime(23,59,59,12,31,date("Y")); ???????}

php 根据当日时间,计算出本日,周,月,季,年,时间戳范围

原文地址:https://www.cnblogs.com/fudongdong/p/9242813.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved