mercredi 24 février 2016

Convert 3 variables to a date in php/laravel 5.1

Im trying to convert 3 variables $day $month $year. Into a date here is my code

$user->age = 23;


$day   = array_rand($days);
$month = array_rand($months);
$year  = date('Y', strtotime('-'.$user->age.' years'));
$date_combine = $day.$month.$year;
$convert = strtotime($date_combine);
$dob = date('d/M/Y', $convert);
dd($dob);

when I output the $dob I just get "01/Jan/1970" when I should be getting "01/Jan/1993". Not sure why this I happening or what Im missing.

Note: Im using laravel 5.1.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire