欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PHP-获取上周一周的日期

程序员文章站 2022-05-15 10:59:31
...

$start1 = date("Y-m-d", strtotime('monday last week'));
$end1   = date("Y-m-d", strtotime('monday this week - 1 days'));

$start2 = date("Y-m-d", strtotime('monday -3 week'));
$end2   = date("Y-m-d", strtotime('monday -2 week - 1 days'));

$start3 = date("Y-m-d", strtotime('monday -4 week'));
$end3   = date("Y-m-d", strtotime('monday -3 week - 1 days'));

$start4 = date("Y-m-d", strtotime('monday -5 week'));
$end4   = date("Y-m-d", strtotime('monday -4 week - 1 days'));


echo " 1: $start4\n";
echo " : $end4\n";
die;

上个月:

$start = date(“Ym01”, strtotime(“last month”));
$end = date(“Ym01”);

相关标签: php