public function InDateTime($timeZone = 'GMT')
 {
     if ($timeZone != 'GMT') {
         throw new Exception('Unsupported TimeZone: ' . $timeZone);
     }
     $time = $this->time->InSeconds() - 3600;
     if (date('I') == 1) {
         $time -= 3600;
     }
     $date = $this->date;
     if ($time < 0) {
         $time += 24 * 3600;
         $date = $date->DateAdd(-1);
     }
     $time = Zeit::FromSeconds($time);
     return new DateTime($date . ' ' . $time, new DateTimeZone($timeZone));
 }
Esempio n. 2
0
 public function beforeOrSame(Zeit $after)
 {
     return $this->InSeconds() <= $after->InSeconds();
 }
/**
 * Smarty zeit_format modifier plugin
 *
 * Type:     modifier<br>
 * Name:     zeit_format<br>
 * Purpose:  format strings via zeit_format
 * @param string
 * @param string
 * @return string
 */
function smarty_modifier_zeit_format(Zeit $zeit)
{
    return $zeit->Format('H:i');
}
 public function testNegativeZeit()
 {
     $this->setExpectedException('DatumException');
     Zeit::fromSeconds(-1);
 }