Print $ week_start & nbsp; date (U, mktime (0, 0, 0, date (m), date (d)-7, date (Y); $ week_end & nbsp; date (U, mktime (23, 59, 59, date (m), date (d)-0, date (Y); $ dateda prints every day of the previous week
$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);
I don't know how to write it here.
I want to use for loop writing, but I don't know how to write the conditions .. How can I print the date of each day?
Share: More
------ Solution --------------------
for($i=7; $i>=0; $i--)
{
echo date('Y-m-d',strtotime("-$i day")).'
';
}
2013-11-27
------ Solution --------------------
// Last Monday
$ N = strtotime ("last week ");
$ Timestamps = 86400;
For ($ I = 0; $ I <7; $ I ++)
{
Echo date ('Y-m-D', $ n + ($ I * $ timestamps )),'
';
}
?>