note 73601 modified in function.strtotime by derick

From: Date: Sun, 08 Apr 2007 12:55:19 +0000
Subject: note 73601 modified in function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125197@lists.php.net to get a copy of this message
SQL datetime columns have a much wider range of allowed values than a UNIX timestamp, and therefore this function is not safe to use to convert a SQL datetime column to something usable in PHP4. Year 9999 is the limit for MySQL, which obviously exceeds the UNIX timestamp's capacity for storage. Also, dates before 1970 will cause the function to fail (at least in PHP4, don't know about 5+), so for example my boss' birthday of 1969-08-11 returned FALSE from this function. [red. The function actually supports it since PHP 5.1, but you will need to use the new object oriented methods to use them. F.e: <?php $date = new DateTime('1969-08-11'); echo $date->format('m d Y'); ?> ] --was-- SQL datetime columns have a much wider range of allowed values than a UNIX timestamp, and therefore this function is not safe to use to convert a SQL datetime column to something usable in PHP4. Year 9999 is the limit for MySQL, which obviously exceeds the UNIX timestamp's capacity for storage. Also, dates before 1970 will cause the function to fail (at least in PHP4, don't know about 5+), so for example my boss' birthday of 1969-08-11 returned FALSE from this function. http://php.net/manual/en/function.strtotime.php

« previous php.notes (#125197) next »