I have a string and I need to find out whether it is a unix timestamp or not, how can I do that effectively?
I found this thread via Google, but it doesn\'t come up
Improved answer to @TD_Nijboer.
This will avoid an exception be thrown if the supplied string is not a time stamp:
function isTimestamp($timestamp) { if(ctype_digit($timestamp) && strtotime(date('Y-m-d H:i:s',$timestamp)) === (int)$timestamp) { return true; } else { return false; } }