Tuesday, March 14, 2017

Two identical codes to format date one doesn't work

I have two columns in database Time_1 and Time_2 which store timestamps.

Then on the view I have this:

<div class="time">Time_1</div>
<pre> | </pre>
<div class="time">Time_2</div>
<pre> | </pre>

Expected result:

Time_1 = 2017/03/14 10:59 am | 1 hour ago
Time_2 = 2017/03/14 10:59 am | 1 hour ago

But I got page break on second time like it's stopped loading of page there.

The error is doesn't make sense to me:

Uncaught TypeError: Argument 1 passed to Illuminate\Exception\PlainDisplayer::display() must be an instance of Exception, instance of Error given,

var_dump($order->order_date) -> `object(Carbon\Carbon)#457 (3) { ["date"]=> string(26) "2017-03-14 10:59:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }`

var_dump($order->payment_status_date) -> `string(19) "2016-12-31 07:11:05"`

The question is why since both are stored as timestamps and I'm using same carbon .. etc I've got this difference and how to fix this?



via VLS

Advertisement