Rama Durai Rama Durai -4 years ago 61
PHP Question

Laravel or php I have a week number of a month and a day, how can i get the date of these..?

i am used

date() strtotime()


and so on... I need the date for a given week number of the month and day of the month..
Example., "3rd Week of the every month and Monday in every month for a year(Any one)" I need these to conditions meet dates for a whole year..

Can you help me..?

Answer Source

for all mondays of a year:

$date = '2016-01-01';
$y = date('Y', strtotime("$date"));
$x = $y;
while(1){
    $date = date('Y-m-d', strtotime("next Monday $date"));
    $y = date('Y', strtotime("$date")); 
    if($x != $y) break;
        echo $date."<br/>"; 
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download