I have theater shows dates in several cultural seasons.
A cultural season is from the first day of September to the last day of August.
Using PHP, I need to know the year of the "last first day of September" relative to the date of the show to assign the right season to the show.
E.g.:
15/05/2009 -> 01/09/2008 : season 2008-2009
21/06/2013 -> 01/09/2012 : season 2012-2013
27/10/2013 -> 01/09/2013 : season 2013-2014
Try this out... will give you start start year for the period.
$targetTime = strtotime("2013-06-05");
$sept1 = strtotime("September 1st", $targetTime);
if ($targetTime < $sept1){
$sept1 = strtotime("-1 Year", $sept1);
}
$year = date("Y", $sept1);