hocam php de sanıyorum şu şekilde
echo date('Y-m-d', strtotime('first day of January 2016'));
hocam böyle hazır kod değil bana algoritma lazım.
echo date('Y-m-d', strtotime('first day of January 2016'));