tags:

views:

28

answers:

0

I have a custom post type and a few custom fields, one is called "Time Available" which shows a date picker and allows the user to pick a date to fill in when a property will be available. I then have it display it in 'mm/dd/yyyy' format.

I'm then trying to display the posts that will be available within a month in a query. Here's the code I'm using:

<?php 
$thirtydays = date('m/d/Y', strtotime('+30 days'));
global $query_string;
query_posts($query_string . "&meta_key=Time Available&meta_compare=<=&meta_value=$thirtydays"); 
?>   

Some of the posts that appear are within 30 days but some are as far as two years out. I'm assuming WordPress is seeing the mm/dd/yyyy format and getting confused. I just can't think of any way to get around this. Any suggestions?