Пример #1
0
 /**
  * Adds Seconds to a given UTC Timestamp. 
  * Respects Winter/Summertime, because of given Timezone of Event
  * Returns UTC Timestamp
  * 
  * @param integer $intUtcTimestamp
  * @param integer $intSecondsToAdd
  * @param string $strEventTimezone
  * @return integer UTC Timestamp
  */
 public function createRepeatableEvents($intUtcTimestamp, $intSecondsToAdd, $strEventTimezone = '')
 {
     $objTimeZone = $strEventTimezone === '' ? $this->userTimeZone : new DateTimeZone($strEventTimezone);
     $objTime = new DateTimeLocale($this->helper_dtime($intUtcTimestamp), $objTimeZone);
     $objTime->setTimezone($objTimeZone);
     if ($intSecondsToAdd > 0) {
         $objTime->add(new DateInterval("PT" . $intSecondsToAdd . "S"));
     } else {
         $objTime->sub(new DateInterval("PT" . $intSecondsToAdd . "S"));
     }
     return $objTime->format("U");
 }
Пример #2
0
 /**
  * Output proper Time
  *
  * @param $format		Format of the Output
  * @param $tstamp		Timestamp
  * @return Formatted		time string
  */
 public function date($format = "Y-m-d H:i:s", $dtime = '', $chk_summer = true)
 {
     //check for summer time
     if ($chk_summer && $this->date('I', $dtime, false) == '1') {
         $dtime += 3600;
     }
     $dateTime = new DateTimeLocale($this->helper_dtime($dtime), $this->serverTimeZone);
     $dateTime->setTimezone($this->userTimeZone);
     return $dateTime->format($format);
 }