Simple PHP question about pulling future dates

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jdurden
Forum Newbie
Posts: 1
Joined: Wed Oct 12, 2011 8:03 am

Simple PHP question about pulling future dates

Post 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 == ? ) { ?>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Simple PHP question about pulling future dates

Post by Celauran »

Take a look at DateTime::modify.
ouchiko
Forum Commoner
Posts: 35
Joined: Sun Oct 09, 2011 6:54 pm
Location: London

Re: Simple PHP question about pulling future dates

Post 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);

?>
Post Reply