views:

17

answers:

1

Hey, I'm trying to build the most intuitive possible Event post type. I'm wondering if there's a core method to both print out and capture the contents of a date field - specifically year/month/day, I don't need hours/minutes. I also need to be able to sort entries by date to print out later - for instance, I need all of the events from January. Something that can save me formatting the fields, and then parsing and saving them manually.

Any ideas are welcomed! Thanks in advance for your time.

A: 

There was no rock solid WP core solution to this, but the system I created is composed of:

SQL CONCAT to compare a date field to CURDATE, etc.

PHP strToTime to get the date back from the database

Generally speaking, if you save your date to the DB in UNIX time format it's easy to work with in SQL queries and in your PHP output.

Gavin