The Daily WTF
In the US, we “fell back”- that is to say we abandoned Daylight Saving Time and moved back to Standard Time, and I think the general consensus is that time changes are the real WTF.
So let’s use this as a moment to look at some bad date handling code, an evergreen topic.
First, we turn to Adam, who’s doing some minor work on an old PHP application.
# Yes this is really how you do date constants in PHP now 🙁 define(‘XXXCutoffDate’, (new DateTime(YEAR . ‘-01-19 00:00:00’, new DateTimeZone(‘America/Chicago’)))->getTimestamp() );
This isn’t inherently how you have to do date constants, but it’s certainly a way to do date constants. Somehow, despite going the route of using constructors and objects, the original developer still managed to find a way to work string concatenation into the process, making this possibly the most PHP of all PHP code.
From Tomasz, we
To read the full article click on the 'post' link at the top.