I find PHP’s date handling a bit confusing. It’s easy when you know how, of course; but even at the same time as appreciating that it’s good in the end that it offers a lot of flexibility, it’s sometimes seemed like there are too many hoops to jump through to do some simple date operations.
Anyway, I’ve just cracked a minor issue I’m working on thanks to this post and this thread. I’m posting the solution here for my quick reference as much as anything…
Problem: how to check if a WordPress post_date (from a $post object) is from a day in the future? Solution:
$postDate = strtotime( $post->post_date );
$todaysDate = strtotime( date( 'Y-m-d' ) );
if ( $postDate > $todaysDate ) {
[ post is from the future! ]
} else {
[ post is from today or the past]
}
Welcome! I build websites - mostly based on the brilliant, free & open 
