vendredi 2 mars 2018

Laravel collective binding time to form::time - Carbon

I tried to binding using 3 different styles but none of them work as expected:

example datetime : 2018-03-02 23:00:00

//using h:i:s A ---> Nothing shown
{!! Form::time('field_name', \Carbon\Carbon::parse($user->relation->col_name)->format('h:i:s A'), ['class'=>'form-control']) !!}

//using h:i A  ----> Nothing shown
{!! Form::time('field_name', \Carbon\Carbon::parse($user->relation->col_name)->format('h:i A'), ['class'=>'form-control']) !!}

//using h:i:s  ----> Shows time but AM/PM does not work
{!! Form::time('field_name', \Carbon\Carbon::parse($user->relation->col_name)->format('h:i:s'), ['class'=>'form-control']) !!}

//using strtotime  -----> same results like above
{!! Form::time('field_name', date('h:i:s A', strtotime($user->relation->col_name)), ['class'=>'form-control']) !!}

Any idea on how to bind 23:00:00 to AM PM which would work?

The first method gives something like below:



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2F7QC6O
via IFTTT

Aucun commentaire:

Enregistrer un commentaire