- 开发无止境 -
Data: 2014-05-11 04:24:24Form: JournalClick: 10
在php中一个有效的时间是从 1970-01-01 07:00:00 – 2038-01-19 03:14:07. 这个的http://php.net/manual/en/function.strtotime.php
首先一个时间戳中肯定没有小数点.
将 1970-01-01 07:00:00 和 2038-01-19 03:14:07转换成时间戳.
1 2 3 4 5 6 7 8 9 10 11 | echo strtotime('2038-01-19 03:14:07'); // 2147454847echo strtotime('1970-01-01 07:00:00'); // 0$valid = ctype_digit($str) && $str <= 2147483647;var_dump($valid); //method 2function is_timestamp($timestamp) { if(strtotime(date('m-d-Y H:i:s',$timestamp)) === $timestamp) { |