Using DATE_FORMAT and Active Records - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Using DATE_FORMAT and Active Records (/showthread.php?tid=19503) |
Using DATE_FORMAT and Active Records - El Forum - 06-09-2009 [eluser]haydenp[/eluser] Hi I'm trying my best to stick to the Active Record approach but sometimes it puts up a bit of a fight! For instance ... has anyone tried to format a date as per below: Code: $this->db->select("table_name.id, DATE_FORMAT(table_name.x_date, '%d %b %Y') as y_date"); Trying my best to stick to the Active Record approach I have attempted a number of variations of the above code without success ... Has anyone else managed to get this to work using the Active Record approach? PS: The code above spews out Code: ... DATE_FORMAT(table_name.x_date, `'%d` %b %Y') ... NOTE: As a "work-around" one can add 'FALSE' as a second parameter to the '$this->db->select' to stop CI from adding the back-ticks ... not ideal but it works! Using DATE_FORMAT and Active Records - El Forum - 06-09-2009 [eluser]Thorpe Obazee[/eluser] [quote author="haydenp" date="1244594672"] NOTE: As a "work-around" one can add 'FALSE' as a second parameter to the '$this->db->select' to stop CI from adding the back-ticks ... not ideal but it works![/quote] It's what the user_guide tells you to do when you come across this. |