Back

Trailing data error in Carbon data from postgresql


Hi, outputing data from created_at field lavarel 5.4/postgresql 9.4 I got error:

InvalidArgumentException in Carbon.php line 582:
Trailing data
in Carbon.php line 582
at Carbon::createFromFormat('Y-m-d H:i:s', '2017-04-20 18:09:54.822115') in ShippingClass.php line 106
at ShippingClass->getCreatedAtAttribute('2017-04-20 18:09:54.822115') in HasAttributes.php line 432

I suppose it dislikes 2017-04-20 18:09:54.822115 format

I googled and tried to add line like :

class ShippingClass extends Model
{
	protected $table = 'shipping_class';
	protected $primaryKey = 'id';
//    protected $dateFormat = 'Y-m-d H:i:s.u';
//    protected $dateFormat = 'Y-m-d H:i:s+';
//    protected $dateFormat = 'Y-m-d H:i:sO';
	protected $dateFormat = 'Y-m-d H:i:sP';

But failed? If there is a way to fix?

Thanks !


Sign in to participate in this thread!


We'd like to thank these amazing companies for supporting us