Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

danny620's avatar

Carbon::createFromDate Date Of Birth Saving Null In DB

I have 3 select drop downs day, month, year when submitted I get 1992 12 10 I then use carbon to create date from and try and save it with my model but when I check the DB the dob is null, the field type is DATE

$dob = Carbon::createFromDate($request->birthday_year, $request->birthday_day, $request->birthday_month); $profile = new Profile; $profile->user_id = $user->id; $profile->dob = $dob;

0 likes
1 reply
bobbybouwmann's avatar
Level 88

You are doing it in the wrong order, it should be year, month, day

$date = Carbon::createFromDate($request->birthday_year, $request->birthday_month, $request->birthday_day);

Please or to participate in this conversation.