Store custom field event_date as a db DATE
-
I would like to code up a custom date field for events in a format that allows DB queries like
SELECT * FROM posts WHERE event_date < today
I have written a jquery date selector and a piece of PHP to convert this date to a UNIX timestamp. Can I now do date based db queries on it?
function save_price(){ global $post; // Store date in UNIX timestamp format with strtotime() update_post_meta($post->ID, "event_date", strtotime($_POST["event_date"])); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Store custom field event_date as a db DATE’ is closed to new replies.