Capture the current first and last day of the week in php

How can I capture and display dates for the first and last day of the current week we are in.

So this week he will output:

2012-05-14 - 2012-05-20 

(Today 2012-05-17)

How can this be done simply?

+3
source share
1 answer

try using strtotime

 $first = date('Ym-d',strtotime("last monday")); $last = date('Ym-d',strtotime("next sunday")); 

other examples

 strtotime('monday this week'); strtotime('sunday this week'); 
+10
source

All Articles