Support the ongoing development of Laravel.io →
Database Eloquent Installation

HI I have a DATE mysql column and i wish to change the stored format from YYYY-MM-DD to dd-mm-yyyy when taking out the DB.

at the moment i have

  $jobs=$jobs->orderBy('created_at','desc')->take($numrow)->select(
               'Date', 'Distance', 'CustMileage', 'created_at', 'updated_at'
            )->get(); 

I tried

  $jobs=$jobs->orderBy('created_at','desc')->take($numrow)->select(
              DB::raw('DATE_FORMAT("Date", "%d %M, %Y")') , 'Distance', 'CustMileage', 'created_at', 'updated_at'
            )->get(); 

but query came back empty for date column?

Thanks for any help

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

scotchegg scotchegg Joined 4 Aug 2015

Moderators

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

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.