Any way to take a date like this 2013-05-29 in PHP and get the date (in the same format) of that weeks monday? So the output would be like this: 2013-05-27
Asked
Active
Viewed 221 times
1 Answers
7
date('Y-m-d', strtotime('last sunday +1 day', strtotime('2013-05-29')));
last sunday +1 day because last monday would return the Monday of the previous week if $timestamp actually was a Monday already.
And parsing of the original date value 2013-05-29 in a second step because all together as one argument does not work well (mixing of absolute and relative date values is something strtotime does not like very much).
CBroe
- 91,630
- 14
- 92
- 150