TimeUtils.php
347 Bytes
<?php
class TimeUtils
{
public static function iso2stamp($iso) {
try {
$time = new DateTime($iso);
}
catch (Exception $e) {
$time = new DateTime('1970-01-01T00:00:00Z');
}
$stamp = $time->format('U');
unset($time);
return $stamp;
}
public static function stamp2iso($stamp) {
return date('Y-m-d\TH:i:s',$stamp);
}
}
?>