Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jdc1898's avatar
Level 21

Nova date vs created_at

Is there a way to use a date formatted as Y-M-D instead of the created_at field? I have existing data that I would like to generate a trend but get an error.

0 likes
2 replies
Minahgo's avatar

This should work:

Date::make('Birthday')->format('Y-M-D'),
jdc1898's avatar
Level 21

I am using the following:

Resource:

        return [
            (new Metrics\Accounts)->width('1/2'),
        ];

Model:

    public function accounts()
    {
        return DB::where('sg_sms_account', '')->select('select date, sg_sms_account')->get();
    }

The issue is when the page loads I get a SQL error.

Column not found: 1054 Unknown column 'created_at' in 'field list' (SQL: select date_format(`created_at` - INTERVAL 5 HOUR, '%Y-%m-%d') as date_result, count(`reports`.`id`) as aggregate from `reports` where `created_at` between 2018-10-31 00:00:00 and 2018-11-29 03:37:32 group by date_format(`created_at` - INTERVAL 5 HOUR, '%Y-%m-%d') order by `date_result` asc)

My date is stored in the table as Y-M-D not the Laravel timestamp way.

Please or to participate in this conversation.