order post my meta value m/d/y format with year as included value

The only date format that sorts into human calendar order is “year/month/day”. The separators shouldn’t matter. If you left your dates in UNIX time format, as you get from strtotime, they would sort appropriately as well.

I would recommend re-organizing your code to match one or the other of those formats. I would go further and recommend that you use unix time. If you save those values in UNIX time format, you can easily display them however you want. That is, just use date("m/d/Y", $unixtimeformatedstring) when you display instead of when you save.

I know unixtime is hard to read, but it plus the PHP functions that can manipulate it, is a miracle worker when it comes to dealing with dates (as long as you don’t need dates too far in the past 🙂 )

Leave a Comment

tech