note 87079 modified in function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Tue, 18 Nov 2008 21:34:10 +0000 |
| Subject: | note 87079 modified in function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146667@lists.php.net to get a copy of this message | ||
<?php
/**
* strToTime wrapper
*
* @param string[optional] $time
* @param int[optional] $now
* @return bool|int - returns false for '0000-00-00' and '0000-00-00 00:00:00'
*/
public static function myStrToTime($time = '', $now = null)
{
if('0000-00-00' == $time || '0000-00-00 00:00:00' == $time) {
return false;
}
//In version 5.2.6 strToTime returns int(-62169966000) for the 0 dates above
return strToTime($time, $now);
}
?>
--was--
Ignore the last note I posted...had a bug.
/**
* strToTime wrapper
*
* @param string[optional] $time
* @param int[optional] $now
* @return bool|int - returns false for '0000-00-00' and '0000-00-00 00:00:00'
*/
public static function myStrToTime($time = '', $now = null)
{
if('0000-00-00' == $time || '0000-00-00 00:00:00' == $time) {
return false;
}
//In version 5.2.6 strToTime returns int(-62169966000) for the 0 dates above
return strToTime($time, $now);
}
http://php.net/manual/en/function.strtotime.php