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? Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/ 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. Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/#findComment-296260 Share on other sites More sharing options...
samoht Posted July 12, 2007 Author Share Posted July 12, 2007 example? Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/#findComment-296403 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. Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/#findComment-296407 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'); Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/#findComment-297598 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. Link to comment https://forums.phpfreaks.com/topic/59623-php-date-confusion/#findComment-297609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.