php - how do i get the 1st day of week from current date -


i 1st date of week?
ie.

 if 2011-01-01 2011-01-01       if 2011-01-06 2011-01-01       if 2011-01-20 2011-01-14       if 2011-01-21 2011-01-21  

sorry misleading , making question confusion.

i want date of 1st day of week, ie. either 1 or 7 or 14 or 21 or 28

by far straight-forward way subtract number of day of week (0 = sunday 'w', 1 = monday 'n') in days date:

$date = strtotime('2011-02-09'); $sunday = strtotime('-' . date('w', $date) . ' days', $date); $monday = strtotime('-' . (date('n', $date) - 1) . ' days', $date); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -