Page 1 of 1

Simple PHP question about pulling future dates

Posted: Wed Oct 12, 2011 8:09 am
by jdurden
This should be simple but I cant figure it out. Basically, I just need to only display titles that have thumbnails, and it should always show titles with dates from the next two months. Therefore, since it is October, it should show the October and November titles, if it's November, it shows Nov and Dec, etc. The part of the code i need help with is at the bottom.

Code: Select all

<?php $width = 940;
					  $height = 277;
							  
					  $classtext = '';
					  $titletext = get_the_title();
					  
					  $date = print(Date("l F d, Y"));

					  $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false);
					  $thumb = $thumbnail["thumb"]; ?>

                <?php // if there's a thumbnail
if($thumb != '' && $date == ? ) { ?>

Re: Simple PHP question about pulling future dates

Posted: Wed Oct 12, 2011 8:46 am
by Celauran
Take a look at DateTime::modify.

Re: Simple PHP question about pulling future dates

Posted: Wed Oct 12, 2011 10:57 am
by ouchiko

Code: Select all

<?

	$time_now = time();
	$one_month = strtotime("+1 month");

	print "Now: " . date('F', $time_now);
	print "Month: ". date('F', $one_month);

?>