Re: No is_date() function?

From: Date: Wed, 25 Jul 2007 14:33:23 +0000
Subject: Re: No is_date() function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-259519@lists.php.net to get a copy of this message
There is no such a thing as a date datatype in PHP. Dates are stored as an integer representing seconds since a base time (1/1/1970) and they cannot be distinguished from other integers. In PHP 5.1 they added a DateTime class which is a good thing for the future, to solve issues like yours, but for the time being, a 'timestamp' as returned by, for example' mktime, is a plain integer. Satyam ----- Original Message ----- From: "Ken Tozier" <kentozier@comcast.net> To: <php-general@lists.php.net> Sent: Wednesday, July 25, 2007 3:55 PM Subject: [PHP] No is_date() function?
Hi I wrote a serialization function to turn arbitrary PHP variables into Macintosh plist compatible XML but see that there is no "is_date" tester as there is for bool, object, array etc. Is there a relatively simple (and robust) way to detect if a variable is a date? For example: $person = array('name'=>'bob', 'sex'=>'male', 'date_of_birth'=> $someDateHere); Thanks for any help Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.10.19/917 - Release Date: 25/07/2007 1:16


« previous php.general (#259519) next »