Re: Question about dates

From: Date: Sat, 25 Dec 2004 01:06:41 +0000
Subject: Re: Question about dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-205159@lists.php.net to get a copy of this message
On Fri, 24 Dec 2004 08:46:28 -0600, Brent Clements <brent.clements@gmail.com> wrote: > How does one over come the issue of unix time not going beyond a certain date? Overcome the issue in what way? A 32bit integer is what it is. > ie, when I do echo strtotime("2099-10-08"); it outputs -1 So don't use strtotime(). You're never going to fit an integer with more than 32bits into a memory space of 32bits or less without losing bits. The PHP manual seems pretty clear in what to do as far as checking for failure: $str = 'Not Good'; if (($timestamp = strtotime($str)) === -1) { echo "The string ($str) is bogus"; } else { echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } > This has to do with the limitations of unix time, so how does one get around it? If it's stored in a db, you can use the date/time fields which usually provide more storage space than 32bits. MySQL has timestamp for example. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/

« previous php.general (#205159) next »