2
votes

For a booking plugin I need to store dates (start date and end date) for each booking. I want to store bookings in a custom post type, so I do not need to make my own tables in the database.

So I will store the dates in a meta.

I could store the date in mysql format, Ymd, or unix timestamp. But which way is best? Which way would be the Wordpress way?

ps: would this also work best for dates stored in settings?

1

1 Answers

0
votes

When querying BETWEEN custom DATE meta fields, WordPress requires the date format to be YYYY-MM-DD. If you plan on using a compare argument of BETWEEN, I recommend storing in this format. Otherwise, it really depends on your use case.