TechnologyWonder Posted May 15, 2008 Share Posted May 15, 2008 how do I automatically "echo" a date 6 months from now. For example, today's date is May 15, 2008. How do I list the date, November 15, 2008? Link to comment https://forums.phpfreaks.com/topic/105736-php-date/ Share on other sites More sharing options...
TechnologyWonder Posted May 15, 2008 Author Share Posted May 15, 2008 Well I found this on php.net/date, will this work? $futuredate = mktime(0, 0, 0, date("m")+6, date("d"), date("Y")); echo "$futuredate"; Link to comment https://forums.phpfreaks.com/topic/105736-php-date/#findComment-541760 Share on other sites More sharing options...
koolego Posted May 15, 2008 Share Posted May 15, 2008 Hi, I'm newbie but I used some code that may work for you and is a little easier to understand <?php // 365 days a year /2 = 182.5 days half year (6mths) // 182.5 days * 24 hours = 4380 $hourdiff = "4380"; // hours diff btwn server 6mths $futdate = date("l, d F Y h:i a",time() + ($hourdiff * 3600)); print ("$futdate"); ?> Link to comment https://forums.phpfreaks.com/topic/105736-php-date/#findComment-541767 Share on other sites More sharing options...
TechnologyWonder Posted May 15, 2008 Author Share Posted May 15, 2008 Yeap. I think that works. But this does exactly what I need. <?php $futuretime = strtotime("+6 month"); $futuredate = date("M/d/Y", $futuretime); echo "$futuredate"; ?> Link to comment https://forums.phpfreaks.com/topic/105736-php-date/#findComment-541776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.