- strtotime: documentation ( source)
<?php
// Everything you enter here will be executed by our servers. Try it!
function stringToTimestamp($timestamp) {
$newTimestamp = strtotime($timestamp);
if ($newTimestamp === FALSE) {
return $timestamp;
}
return $newTimestamp;
}
echo stringToTimestamp("1374366918");