Customize the timestamp format on your model in Laravel
By default, timestamps are formatted as 'Y-m-d H:i:s'
. If you need to customize the timestamp format, set the $dateFormat
property on your model. This property determines how date attributes are stored in the database:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The storage format of the model's date columns.
*
* @var string
*/
protected $dateFormat = 'U';
}