php - How many, of a given weekday there has been since the beginning of this month? -
i have date, , find out how many, of weekday, there has been since beginning of month. (should 1-5)
the reason need number because telling customers deliver on "the 4rd wednesday of month" example.
i not need returns number of weeks has been starting predefined beginning day of week (every example can find that).
it may know have implemented reverse of code follows:
echo date('y-m-d', strtotime("2013-08 4 wednesday")); //returns 4th wednesday of month namely "2013-08-28"
how can "4" starting "2013-08-28"?
an expression should work minimal changes code.
<?php $d = date('d', strtotime("2013-08-28")); echo ceil($d/7).php_eol; ?>
outputs '4'. i'm sure can wrap in function.
Comments
Post a Comment