format($format)); } try { $from_obj = new DateTimeZone($tz_from); } catch (Exception $e) { $from_obj = new DateTimeZone('UTC'); } try { $d = new DateTime($s, $from_obj); } catch (Exception $e) { logger('DateTimeFormat::convert: exception: ' . $e->getMessage()); $d = new DateTime('now', $from_obj); } try { $to_obj = new DateTimeZone($tz_to); } catch (Exception $e) { $to_obj = new DateTimeZone('UTC'); } $d->setTimeZone($to_obj); return $d->format($format); } }