note 55444 deleted from function.strtotime by nlopess

From: Date: Thu, 04 Aug 2005 10:08:03 +0000
Subject: note 55444 deleted from function.strtotime by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93050@lists.php.net to get a copy of this message
Note Submitter: IronMo ---- The php strtotime() function is a buggy mess (and demostrates one of the main arguments against a perpetually buggy and unstable PHP). Avoid this function all costs unless you are positive your code will only be run on a non-buggy version of php: echo date( 'Y-m-d H:i:s', strtotime('Wed Aug 3 16:36:07 MDT 2005') ); and echo date( 'Y-m-d H:i:s', strtotime('Wed Aug 3 16:36:07 2005') ); both return 1969-12-31 16:59:59 on at least php 4.3.2 and possibly others. PHP 4.3.11 does not have this problem as, I can only assume, others more recently have not had as well. Also beware of seemingly harmeless order changes like: echo date( 'Y-m-d H:i:s', strtotime('2005 Aug 3 16:36:07') ); which returns the very incorrect, although still valid date: 2009-01-25 16:36:07 For these many reasons, I only use strtotime if I have no other choice--especially with data headed for data base inserts.

« previous php.notes (#93050) next »