OOzy Pal wrote:
How can I check an inputed date if it is a valid date and if it is in
the form of a timestamp or regular date such as (22-07-2007 or
22/07/2007)
You could first check if the variable consists only of numbers. If so,
it's likely a timestamp. If $var does consist of something other than
digits, pass it to strtotime() first.
$arr_date = (
ctype_digit($var)
? getDate($var)
: getDate(strtotime($var))
);
Finally, check that the date is legitimate:
if (checkdate($arr_date['mon'], $arr_date['mday'], $arr_date['year']))
{
...
}
brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php