Cakephp 3.x order by date with different date notations
<p>I have a row (varchar) with date notations retreived from digital camera's.
This notation differs between types and models.</p>

<p>Now, I want to order this row by datetaken ASC or DESC. </p>

<pre><code>-&gt;order(['Searches.datetaken' =&gt; 'DESC']);
</code></pre>

<p>This is not working correct with values like <code>20100115</code> and <code>20160302164444</code> (example).</p>

<p>To fix this, I want to use <code>STR_TO_DATE()</code>
But how do I use this in a correct way in Cakephp 3.x
This is not working:</p>

<pre><code>-&gt;order([STR_TO_DATE(Searches.datetaken,'Ymd') =&gt; 'DESC']);
</code></pre>