×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Matt Parry
Added: Sep 6, 2017 6:49 PM
Views: 8
Tags: no tags
  1. $week_start = strtotime('last Sunday', time());
  2. $week_end = strtotime('next Sunday', time());
  3.  
  4. $month_start = strtotime('first day of this month', time());
  5. $month_end = strtotime('last day of this month', time());
  6.  
  7. $year_start = strtotime('first day of January', time());
  8. $year_end = strtotime('last day of December', time());
  9.  
  10. echo date('D, M jS Y', $week_start).'<br/>';
  11. echo date('D, M jS Y', $week_end).'<br/>';
  12.  
  13. echo date('D, M jS Y', $month_start).'<br/>';
  14. echo date('D, M jS Y', $month_end).'<br/>';
  15.  
  16. echo date('D, M jS Y', $year_start).'<br/>';
  17. echo date('D, M jS Y', $year_end).'<br/>';