How can I get results of a meta_value with "order by ASC" date in a postmeta value?

94 Views Asked by At
```
  1. table = postmeta

  2. post_id = '1521';

  3. meta_key = 'store_data';

  4. meta_value = 'holiday_dates';

  5. s:16:"holiday_dates";a:9:{i:12396;s:10:"2021/04/13";i:535943;s:10:"2021/04/14";i:271520;s:10:"2021/04/15";i:804617;s:10:"2021/04/21";i:515516;s:10:"2021/04/30";i:476758;s:10:"2021/04/19";i:355992;s:10:"2021/04/28";i:862607;s:10:"2021/05/17";i:616642;s:10:"2021/05/12";

1

There are 1 best solutions below

0
On

Got it, works for me.

$holiday_dates = get_post_meta(1521,'holiday_dates');

sort($holiday_dates);

sort() - sort arrays in ascending order

rsort() - sort arrays in descending order