title: ZF2 - \Zend\Db\Sql\Expression and DATE_FORMAT
body: <p>I'm using Zend Framework 2.4 and trying to amend a working SQL columns select from</p>
  
  <pre><code>'content_publish_date' =&gt; 'publish_date',
  </code></pre>
  
  <p>to </p>
  
  <pre><code>'content_publish_date' =&gt; new \Zend\Db\Sql\Expression('DATE_FORMAT(\'content.publish_date\',\'%d/%c/%Y\')'),
  </code></pre>
  
  <p>produces the following SQL...</p>
  
  <pre><code>DATE_FORMAT('content.publish_date','%%d/%%c/%%Y') AS `content_publish_date`,
  </code></pre>
  
  <p>... which fails syntactically on MySQL (note the extra '%')</p>
  
  <p>I have tried various alternatives...</p>
  
  <pre><code>'content_publish_date' =&gt; new \Zend\Db\Sql\Expression('DATE_FORMAT(content.publish_date,\'%d/%c/%Y\')'),
  'content_publish_date' =&gt; new \Zend\Db\Sql\Expression('DATE_FORMAT(content.publish_date,"%d/%c/%Y")'),
  </code></pre>
  
  <p>... and so on, none of which has helped.</p>
  
  <p>Does anyone have any idea how to use the Expression correctly to get the correct generated SQL?</p>
  
  <p>The full code for this piece is as follows:</p>
  
  <pre><code>        $dbSelect-&gt;join(
              'content',
              'content.id = category.content_id',
              array(
                  'content_title'             =&gt; 'title',
                  'content_html_title'        =&gt; 'html_title',
                  'content_description'       =&gt; 'description',
                  'content_content_text'      =&gt; 'content_text',
                  'content_url'               =&gt; 'url',
                  'content_url_vars'          =&gt; 'url_vars',
                  'content_meta_keyword'      =&gt; 'meta_keyword',
                  'content_meta_description'  =&gt; 'meta_description',
                  'content_content_type_id'   =&gt; 'content_type_id',
                  'content_disclaimer_id'     =&gt; 'disclaimer_id',
                  'content_agent_target_id'   =&gt; 'agent_target_id',
                  'content_video_position'    =&gt; 'video_position',
                  'content_video_size'        =&gt; 'video_size',
                  'content_creation_date'     =&gt; 'creation_date',
                  'content_publish_date'      =&gt; new \Zend\Db\Sql\Expression('DATE_FORMAT(\'content.publish_date\',\'%d/%c/%Y\')'),
                  'content_flag_content_url'  =&gt; 'flag_content_url',
                  'content_flags'             =&gt; 'flags'
              ),
              \Zend\Db\Sql\Select::JOIN_LEFT
          );
  </code></pre>
  
  <p>Thanks in advance.</p>