How do I possible to work with this code to work with date format Y-n-j
Value
start_date = 2011-1-20
end_date = 2011-1-30
Here are the original function came from this Query between two meta values?
function date_check_join( $join ) {
global $wpdb;
$join .= " JOIN ".$wpdb->postmeta." AS startdate ON
(".$wpdb->posts.".ID = startdate.post_id AND
startdate.meta_key = 'start_date')
JOIN ".$wpdb->postmeta." AS enddate ON
(".$wpdb->posts.".ID = enddate.post_id AND
enddate.meta_key = 'end_date')";
return $join;
}
function date_check_where( $where ) {
$today = date('Y-n-j'); /* I change this format to date('Y-n-j')*/
$where .= " AND startdate.meta_value <= $today
AND enddate.meta_value >= $today";
return $where;
}
This function is working with UNIX TIME STAMP date('Ymd')
and when I change date format it doesn't work with date('Y-n-j')
credit @goldenapples
strtotime
?