I’m trying to order my posts by MySQL datetime field So I’m instating data in following format
gmdate('Y-m-d h:i:s');
Below my query
SELECT * FROM posts WHERE post_stats = 1 ORDER BY published_date DESC LIMIT 10
And the posts order is wrong. Then I tried
SELECT * FROM posts WHERE post_stats = 1 ORDER BY DATE(published_date) DESC LIMIT 10
Also tried
SELECT * FROM posts WHERE post_stats = 1 ORDER BY UNIXDATE(published_date) DESC LIMIT 10
Still the posts order is wrong.
EDIT
Ex
my posts should be displayed as
post 2 | 2016-12-20 04:52:08
post 1 | 2016-12-20 04:51:20
but it is displaying as
post 1 | 2016-12-20 04:51:20
post 2 | 2016-12-20 04:52:08
Can someone point me out what I’m doing wrong here? Appreciate your time.