$week_start = date("U",mktime(0,0,0,date("m"),date("d")-7,date("Y")));$week_end = date("U",mktime(23,59,59,date("m"),date("d")-0,date("Y")));$date=date('Y-m-d',$week_start);$date1=date('Y-m-d',$week_end);
写到这里不知道该怎么写了。
我想用for循环写可是判断条件不知道怎么写了。。怎么才能把每一天的日期打印出来啊
回复讨论(解决方案)
这是我看到别人收藏的文章中的一部分。你自己去变通一下
echo "今天:".date("Y-m-d")."
";
echo "昨天:".date("Y-m-d",strtotime("-1 day")), "
";
echo "明天:".date("Y-m-d",strtotime("+1 day")). "
";
echo "一周后:".date("Y-m-d",strtotime("+1 week")). "
";
echo "一周零两天四小时两秒后:".date("Y-m-d G:H:s",strtotime("+1 week 2 days 4 hours 2 seconds")). "
";
echo "下个星期四:".date("Y-m-d",strtotime("next Thursday")). "
";
echo "上个周一:".date("Y-m-d",strtotime("last Monday"))."
";
echo "一个月前:".date("Y-m-d",strtotime("last month"))."
";
echo "一个月后:".date("Y-m-d",strtotime("+1 month"))."
";
echo "十年后:".date("Y-m-d",strtotime("+10 year"))."
";
$week_start = strtotime(date('Y-m-d',strtotime('-6 day')));$week_end=strtotime(date('Y-m-d',time()));for($i=$week_start; $i<=$week_end; $i+=86400){echo date('Y-m-d',$i).'
';}
2013-11-23
2013-11-24
2013-11-25
2013-11-26
2013-11-27
2013-11-28
2013-11-29
for($i=7; $i>=0; $i--){ echo date('Y-m-d',strtotime("-$i day")).'
';}
2013-11-22
2013-11-23
2013-11-24
2013-11-25
2013-11-26
2013-11-27
2013-11-28
2013-11-29