From one of my other posts, getting unixtimestamp:
$unixTimestamp = time();
Convert to mysql datetime format:
$mysqlTimestamp = date("Ymd H:i:s", $unixTimestamp);
Getting some mysql timestamp:
$mysqlTimestamp = '2013-01-10 12:13:37';
Convert it to unixtimestamp:
$unixTimestamp = strtotime('2010-05-17 19:13:37');
... comparing it with one or more times to find out if the user has been entered in a realistic time:
if($unixTimestamp > strtotime("1999-12-15") && $unixTimestamp < strtotime("2025-12-15")) {...}
Unix timestamps are also more secure. You can do the following to validate the passed URL variable before checking (for example) a previous range check:
if(ctype_digit($_GET["UpdateTimestamp"])) {...}
Florian Mertens Jan 10 '13 at 14:46 2013-01-10 14:46
source share