1 2 3 4 5 6 7 8 9 10 11 12 |
<?php date_default_timezone_set('Europe/London'); echo date('Y-m-d', strtotime('last day of previous month')),"<br>"; echo date('Y-m-d', strtotime("10 September 2000")), "<br>"; echo date('Y-m-d', strtotime("+1 day")), "<br>"; echo date('d/m/Y', strtotime("+1 week")), "<br>"; echo date('d/m/Y', strtotime("+1 week 2 days 4 hours 2 seconds")), "<br>"; echo date('d/m/Y', strtotime("next Thursday")), "<br>"; echo date('d/m/Y', strtotime("last Monday")), "<br>"; ?> |
And date minus 17 years
1 2 3 |
echo date('d/m/Y', strtotime("-17 years")), "<br>"; |
and if that does not work this will (last day of month)
1 2 3 |
echo $lastDay = date('Y-m-d', mktime(-1, 0, 0, date("m"), 1, date("Y"))); |
First day of month
1 2 3 4 5 |
echo $firstDay = date('Y-m-d', mktime(+1, 0, 0, date("m"), 1, date("Y"))); OR echo date('Y-m-d', strtotime('first day of this month')); |
+7 days from first day of month
1 2 3 4 5 |
echo $firstDay = date('Y-m-d', mktime(+1, 0, 0, date("m"), 1, date("Y"))); echo "<br>"; echo $lastday = date('Y-m-d', strtotime('+7 days', strtotime($firstDay))); |