// given a unix timestamp, return a value timestamp string
// suitable for use with the database
- static function unixtime($unix) {
- list($unix) = explode('.', $unix, 2);
- if ($unix == 0) {
- return null;
- }
- if ($unix < 10) {
- throw new Exception("unix time $unix is too small\n");
- }
- $d = date_create("@$unix", new DateTimeZone('UTC'));
- // 2008-12-22T05:42:42.285445Z
- if (!is_object($d)) {
- throw new Exception("failed to create date for time $unix");
+ static function unixtime($unix)
+ {
+ list($unix) = explode('.', $unix, 2);
+ if ($unix == 0) {
+ return null;
+ }
+ if ($unix < 10) {
+ throw new Exception("unix time $unix is too small\n");
+ }
+ $d = date_create("@$unix", new DateTimeZone('UTC'));
+ // 2008-12-22T05:42:42.285445Z
+ if (!is_object($d)) {
+ throw new Exception("failed to create date for time $unix");
+ }
+ return $d->format('Y-m-d\TH:i:s.u\Z');
}
- return $d->format('Y-m-d\TH:i:s.u\Z');
- }
static function get()
{