Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP只想回显本周周日和本周周六,与上周相同_Php - Fatal编程技术网

PHP只想回显本周周日和本周周六,与上周相同

PHP只想回显本周周日和本周周六,与上周相同,php,Php,我读了很多长篇文章和答案,但没有一篇文章简单地描述了这一点,所有文章都讨论了不同的变量,其中许多给出了不同的开始日期 只是想说 本周 $thissunday= xxxx; (in dd/mm/yyyy) $thissaturday=yyyy; (in dd/mm/yyyy) 前一周呢 $lastsunday= xxxx; (in dd/mm/yyyy) $lastsaturday=xxx; (in dd/mm/yyyy) 我试过这个 $thisws = strtotime('Sunday t

我读了很多长篇文章和答案,但没有一篇文章简单地描述了这一点,所有文章都讨论了不同的变量,其中许多给出了不同的开始日期

只是想说

本周

$thissunday= xxxx; (in dd/mm/yyyy)
$thissaturday=yyyy; (in dd/mm/yyyy)
前一周呢

$lastsunday= xxxx; (in dd/mm/yyyy)
$lastsaturday=xxx; (in dd/mm/yyyy)
我试过这个

$thisws = strtotime('Sunday this week');
$thiswe = strtotime('Saturday this week');
$lastws = strtotime('Sunday last week');
$lastwe = strtotime('Saturday last week');
并给出长时间无用的数字似乎时间戳

有那么复杂吗

那个“无用的数字”是一个UNIX时间戳

正如文档中所说:“将任何英文文本datetime描述解析为Unix时间戳”

使用函数如下:


不要不尊重unix时间戳。我不会不尊重unix或时间戳,也不会同时不尊重两者,我理解它们是什么,并且已经为我解决了很多事情。。。我的意思是,他们是无用的这种方式,我想一种方式,以打击他们,所以我可以使用他们。谢谢你,查理。哦,我只是在玩,伙计。一旦你意识到格式化时间戳的威力,你会希望所有的东西都可以作为时间戳使用!谢谢查理,我现在明白了:)好吧,这是可行的,但不能给出正确的日期。见此:$thisws=date('d/m/Y',strottime('Sunday this week')$thiswe=日期('d/m/Y',标准时间('本周星期六')$lastws=日期('d/m/Y',标准时间('Sunday last week')$lastwe=日期('d/m/Y',标准时间('上周星期六');本周返回日期:2015年2月22日-2015年2月21日,以及2015年2月15日至2015年2月14日的上周返回日期不正确。见此:$thisws=date('d/m/Y',strottime('Sunday this week')$thiswe=日期('d/m/Y',标准时间('本周星期六')$lastws=日期('d/m/Y',标准时间('Sunday last week')$lastwe=日期('d/m/Y',标准时间('上周星期六');本周返回:2015年2月22日-2015年2月21日,上一周2015年2月15日至2015年2月14日不正确。2月22日确实是即将到来的周日。2月21日确实是即将到来的星期六。2月15日确实是上周日。问题是什么?再次感谢Charlie,我现在理解了这个概念,认为上周日是上周的周日grrrrrrrr这更符合逻辑,还有一些关于如何使用上周日的其他文档-1周,很好:D
<?php echo date('d/m/Y', strtotime('Sunday last week'));