I want to convert 59 to 2012-feb-29. I already know current year is 2012. I try following code. but it give 2012-mar-01.
$string = '59 2012'; $date1 = date_create_from_format('z Y', $string); $date_time = date_format($date1, 'Y-m-d'); echo $date_time;
Advertisement
Answer
You could use strtotime()
instead:
echo date('Y-m-d', strtotime('2012-01 +59 day'));