samoht Posted July 12, 2007 Share Posted July 12, 2007 hello again, I have this variable that sets the date range to 1 month (actualy the end of the month): $Num = $TotalDays - substr($Date,6,2); $NumDaysLater = date('Ymd', strtotime($Date) + (60*60*24*$Num)); $AddQWhereEvents = "eventdates.EventDate >= '$Date' AND eventdates.EventDate <= '$NumDaysLater'"; where Total days: $TotalDays = $_GET[Date] ? date('t',strtotime($_GET[Date])) : date('t'); I would like to do the same thing - but for a year. e.g. 365 or 364 days later. Any ideas on how to do that? Quote Link to comment Share on other sites More sharing options...
Fearpig Posted July 12, 2007 Share Posted July 12, 2007 You could convert the date into three integer variables ($Day, $Month, $Year) and add one to the year and convert them back into a date... that way it will add the correct amount regardless of leap years! There's probably a better way though. Quote Link to comment Share on other sites More sharing options...
samoht Posted July 12, 2007 Author Share Posted July 12, 2007 example? Quote Link to comment Share on other sites More sharing options...
metrostars Posted July 12, 2007 Share Posted July 12, 2007 What's $date in the above code? Is it just the current date, and if so, in what format. Quote Link to comment Share on other sites More sharing options...
samoht Posted July 13, 2007 Author Share Posted July 13, 2007 $Date = $_GET[Date] ? $_GET[Date] : date('Ymd'); Quote Link to comment Share on other sites More sharing options...
metrostars Posted July 13, 2007 Share Posted July 13, 2007 so you've got the date coming from the URL? I'm confused. 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.