其他教程

其他教程

Products

当前位置:首页 > 其他教程 >

PHP获取当前季度的开始时间和结束时间

GG网络技术分享 2025-03-18 16:17 0


之前在网上找了一些获取季度开始时间和结束时间的算法,结果发现好多都是错误的


下面这个是我验证过的,目前没发现错误


$season = ceil((date(‘n’))/3);

$season_start = date(‘Y-m-d’, mktime(0,0,0,$season*3-3+1,1,date(‘Y’)));

$season_end = date(‘Y-m-d’, mktime(23,59,59,$season*3,date(‘t’,mktime(0,0,0,$season*3,1,date(“Y”))),date(‘Y’)));

print_r($season_start.’-‘.$season_end);

标签: 季度 都是

提交需求或反馈

Demand feedback