views:

182

answers:

1

hey, i want to format a date in mysql using

DATE_FORMAT(tblnews.datead, '%M %e, %Y, %l:%i%p')

i cant seem to get the quotes right , so i keep getting errors. how would you put this in a query?

A: 

I think that is what Database_Expression is used for :

in v2.x read this thread : http://forum.kohanaphp.com/comments.php?DiscussionID=277&page=1#Item%5F7 It is implemented in v2.4 and probably is in 2.3, but I am not sure as I am not using it.

in v3.0 search for Database_Expression in the Database Module. Should be something like

$expr=new Database_Expression('DATE_FORMAT(tblnews.datead, "%M %e, %Y, %l:%i%p")');

then

$db->select($expr)->from()...

Anyway, if you really can't do it, you can still use query() and write your query manually...

ccazette