Reputation: 173
I have a custom timestamp field in my database, delivery_date
$table->timestamp('delivery_date')->nullable();
Whenever I try to utilize this field, it brings it in as a string...
"2018-12-17 00:00:00"
but if I use the same code with the created_at
timestamp for example, it brings it in as the timestamp.
date: 2018-12-09 00:00:00.0 America/New_York (-05:00)
I have attempted changing the field in the migration to datetime
and date
with the same result.
I have also attempted converting the result via...
strtotime($order->delivery_date)
but for some reason it converts it to an integer.
Upvotes: 2
Views: 2130
Reputation: 310
in order to get delivery_date as created_at you have to add delivery_date to your model as protected $dates = ['delivery_date'];
Upvotes: 12