Re: No is_date() function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Wednesday, July 25, 2007 3:55 PM
Subject:  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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux