Welcome Guest, Not a member yet? Register   Sign In
MySQL Date_Format and Query Builder

Good Morning all,

So I tried the query builder now I am running into a classic SQL error. 

This is the piece of code I am having a problem with and cannot get to work properly:

PHP Code:
$this->builder->select('*,DATE_FORMAT(published_on,"%M %d, %Y at %H:%i") as Published');
$result $this->builder->get(); 

It returns the result as expected, BUT and this is a BIG BUT, this is the result that returns:

May `21`, 2020 at 08:31

Running the straight SQL instead of using the Builder it returns a properly formatted result:
May 21, 2020 at 08:31

How do I stop the backticks from surrounding the day part in the Builder version? Or should I return to using SQL where I have more granular control of the queries?

I tried this found on another forum on here:
$this->builder->set(date_format(published_on,"%M %d, %Y at %H:%i") as Published,FALSE);

But this made absolutely no difference to the returned result

Messages In This Thread
MySQL Date_Format and Query Builder - by stlake2011 - 05-21-2020, 05:51 AM

Theme © iAndrew 2016 - Forum software by © MyBB