javascript - getting first saturday in specific date and year -


i have code in php,the function of first saturday in month

date_default_timezone_set('asia/jakarta'); $dt             = new datetime('first saturday of month'); $periode        = $dt->format('y-m-d'); 

it's mean result first saturday of month(july), want first saturday of january 2015,so change code being

$dt             = new datetime('first saturday of january 2015'); 

but has wrong result. me please

you can use strtotime, see the ref in php manual

echo date('d-m-y', strtotime('first sat of jan 2015')); 

Comments