One way to achieve this is to use relative formats for strtotime()
.
Unfortunately, this is not so simple:
strtotime('Friday of second week of September 2013');
For weeks to work as you like, you need to call strtotime()
again with a relative timestamp.
$first_of_month_timestamp = strtotime('first day of September 2013'); $second_week_friday = strtotime('+1 week, Friday', $first_of_month_timestamp); echo date('Ym-d', $second_week_friday);
Note Starting from the first day of the month, starting from the first week, I reduced this week accordingly.
source share