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? Quote Link to comment 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"; Quote Link to comment 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"); ?> Quote Link to comment 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"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.