Bizzarre and slightly annoying PHP date increment problem.

Soldato
Joined
20 Feb 2004
Posts
4,035
Location
Blyth, Northumberland
I have the following code which works fine:

Code:
$currentSeason = date ('Y') - 1 . "-" . date ('Y');

The output I get is "2007-2008" as expected.

For some reason the following code doesn't want to work:

Code:
$currentSeason = date ('Y') . "-" . date ('Y') + 1;

The output I get is "2009" :confused: It should be "2008-2009". I think I've coded it incorrectly but can't see where I've gone wrong.
 
Back
Top Bottom