It is very easy to use DATE_FORMAT in simple MySQL query like:
$sql = select DATE_FORMAT(STR_TO_DATE(DateTime`,’%Y%m%d’),’%Y%m%d’) from table;
But to use DATE_FORMAT using Zend_DB query format, query needs to be written in below format in zend framework.
new Zend_Db_Expr (‘DATE_FORMAT( FROM_UNIXTIME( `table_fieldname` ) , ‘%m/%d/%Y %h:%i:%s %p’ )’)
Example:
$sql = $db->select()
->from(array(‘tbl1’ => table1), array(‘firstname’
new Zend_Db_Expr (‘DATE_FORMAT( FROM_UNIXTIME( `table_fieldname` ) , ‘%m/%d/%Y %h:%i:%s %p’ )’)));