Forums › Forums › Search & Filter Pro › Sort by Unix Timestamp Not Working
- This topic has 5 replies, 4 voices, and was last updated 5 years, 7 months ago by
Trevor.
-
Trevor(Private) December 6, 2018 at 12:18 pm #195479
I am sorry, but we do not support timestamps at this version of the plugin, only dates. The only ‘date’ that can be sorted in the Posts settings tab is the Post Date. Any Post Meta data that is a date needs to be saved as a SQL date, in this format: YYYYMMDD and then sorted as a number.
Your times would need to be stored in a similar way (as numbers). E.g 3:15PM and 30 seconds would have to be stored in the 24 hour clock like this: 151530. Then that can be sorted.
So, combining that time with today’s date would be 20181206151530.
Anonymous(Private) May 21, 2019 at 3:59 pm #211836Hi, I’m using the latest version of this plugin. It seems that this problem still exists (just in the DESC case, not in the ASC one). Please, could me explain why I can’t sort posts by Unix timestamps if these timestamps are numbers? I think that using meta_value_num should be enough (in the Post Meta tab it works for filtering). Thank you.
Anonymous(Private) November 21, 2019 at 11:54 pm #227293For anyone else having this issue, it seems you can currently sort by a unix timestamp by selecting “alphabetical”. Unfortunately the ascending/descending controls seem to have no effect and your results will always show up in descending order (Most Recent first).
Unix timestamps are literally just a number which if sorted normally would give us the desired result, so it seems silly to say that it’s not supported, as the website says you can sort a metadata field numerically. In my case I’m curious if the issue is being caused by the timestamp being stored in a single value array:
array ( 0 => '1568643510', )
I’m going to do some tests and see if the S&F works correctly with simple numbers stored as meta-data. I’ll let you know if I find anything interesting.
-
AuthorPosts