week range - get the start and end date of the week


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function week_range($date) {
  2. $ts = strtotime($date);
  3. $start = (date('w', $ts) == 0) ? $ts : strtotime('last monday', $ts);
  4. return array(date('d.m.Y', $start), date('d.m.Y', strtotime('next sunday', $start)));
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.