Posts Tagged "last monday"

Get the First Monday of the current Month or Get Last Day of Month or Get First Day of Month

Get the First Monday of the current Month or Get Last Day of Month or Get First Day of Month Get the First Monday of the current Month <?php function getFirstMonday($month,$year) { $num = date(“w”,mktime(0,0,0,$month,1,$year)); if($num==1) return date(“Y-M-ds”,mktime(0,0,0,$month,1,$year)); elseif($num>1) return date(“Y-M-d”,mktime(0,0,0,$month,1,$year)+(86400*(8-$num))); else return date(“Y-M-d”,mktime(0,0,0,$month,1,$year)+(86400*(1-$num))); } $month = date(“m”); $year = date(“Y”); // this will output current month’s First Monday echo getFirstMonday($month,$year); ?> Get the Last Day of current Month <?php echo date(‘d/m/y’,strtotime(“last Friday”,mktime(0,0,0,date(“n”)+1,1))); // you can replace your Day instead…

Read More