This might help you out: http://laravelsnippets.com/snippets/handle-date-formats-on-model
Source: http://laravel.com/docs/5.1/eloquent-mutators#accessors-and-mutators
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have a different form for adding and editing users, since I cannot use the same date format on my edit form.
My date format is 'd.m.Y', so I use this in my edit form:
{!! Form::input('text', 'birthday', $user->birthday->format('d.m.Y'), ['class' => 'form-control']) !!}
But on my create form I don't need it. My intention was to extract the form into a partial so I can minimize code duplications. When I use "null" as 3. parameter to Form::input() it'll print the right date but in a wrong format.
Is there any way to change the overall date format or any other way to solve my problem easily?
Thanks!
This might help you out: http://laravelsnippets.com/snippets/handle-date-formats-on-model
Source: http://laravel.com/docs/5.1/eloquent-mutators#accessors-and-mutators
Please or to participate in this conversation.