Blame view

php/classes/TimeUtils.php 347 Bytes
5446b8f0   Benjamin Renard   Move CacheTools i...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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);
	}
}

?>