MySQL order by DATETIME field outputting wrong posts order
<p>I’m trying to order my posts by MySQL datetime field
So I’m instating data in following format</p>

<pre><code>gmdate('Y-m-d h:i:s');
</code></pre>

<p>Below my query </p>

<pre><code>SELECT * FROM posts WHERE post_stats = 1 ORDER BY published_date DESC LIMIT 10
</code></pre>

<p>And the posts order is wrong. Then I tried </p>

<pre><code>SELECT * FROM posts WHERE post_stats = 1 ORDER BY DATE(published_date) DESC LIMIT 10
</code></pre>

<p>Also tried</p>

<pre><code>SELECT * FROM posts WHERE post_stats = 1 ORDER BY UNIXDATE(published_date) DESC LIMIT 10
</code></pre>

<p>Still the posts order is wrong. </p>

<p>EDIT</p>

<p>Ex</p>

<p>my posts should be displayed as</p>

<pre><code>post 2 | 2016-12-20 04:52:08
post 1 | 2016-12-20 04:51:20
</code></pre>

<p>but it is displaying as </p>

<pre><code>post 1 | 2016-12-20 04:51:20
post 2 | 2016-12-20 04:52:08
</code></pre>

<p>Can someone point me out what I’m doing wrong here? Appreciate your time.</p>