Is there any PHP function that returns the date of the first week ,
i:e, if i pass "Monday" , it should return 02 of september,
i know, how to get the day, month, date like
date('l') , date('m'), date ('d')
But stuck at this point
Is there any PHP function that returns the date of the first week ,
i:e, if i pass "Monday" , it should return 02 of september,
i know, how to get the day, month, date like
date('l') , date('m'), date ('d')
But stuck at this point
This should get you started:
$dt = new DateTime('first Monday of this month');
echo $dt->format('l m d');
You can use strotime()
, like so:
function getDateFromDay($day) {
return date('d-m-Y', strtotime("first $day of this month"));
}
Usage:
echo getDateFromDay('Monday');
Output:
02-09-2013