note 45016 deleted from function.strtotime by derick

From: Date: Sun, 14 Aug 2005 11:49:40 +0000
Subject: note 45016 deleted from function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93591@lists.php.net to get a copy of this message
Note Submitter: Mike Toppa ---- If you're using SQL Server, it returns dates as a fixed length field, which means you'll often get whitespace at the end of a date. If you use strtotime() on such a date, it will behave correctly about half the time. The other half, it will return -1 (to demonstrate, run it through a web page, and keep hitting reload, and you'll see it randomly jump back and forth). This isn't a strtotime bug, as I assume it's not designed to handle whitespace. So the solution is to trim any dates you get from SQL Server tables before using strtotime() on them. This is also a problem if you use Smarty's date formatting features. Trim dates you get from SQL Server before you send them to Smarty.

« previous php.notes (#93591) next »