Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display timestamp format in edit form in laravel?

I am trying to write update function in laravel, and I am trying to get the old value in edit form, the text fields are easy to retrive back in the form, and also date fields is also working, but for the timestamp field, I coudn't able to get the old value.Please help me out.This simple date field is working.

  <input type="date" value="{{Carbon\Carbon::parse($package->start_date)->format('Y-m-d')}}" name="start_date">

But for the timestamp field, I tried many format, for example like

 <input type="datetime-local" value="{{Carbon\Carbon::parse($package->start_date)->format('Y-m-d H:i:s')}}" name="start_date">
like image 239
Soul Coder Avatar asked Dec 22 '25 03:12

Soul Coder


1 Answers

For date input type use toDateString() method, for datetime-local input type use toDateTimeLocalString() or format('Y-m-d\TH:i:s')

like image 74
Yamen Ashraf Avatar answered Dec 23 '25 17:12

Yamen Ashraf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!