Esempio n. 1
0
 /**
  * @return null|int
  */
 public function ToDatabase()
 {
     if ($this->interval != null && !$this->interval->IsNull()) {
         return $this->interval->TotalSeconds();
     }
     return null;
 }
Esempio n. 2
0
 /**
  * @param DateDiff $difference
  * @return Date
  */
 public function ApplyDifference(DateDiff $difference)
 {
     if ($difference->IsNull()) {
         return $this->Copy();
     }
     $newTimestamp = $this->Timestamp() + $difference->TotalSeconds();
     $dateStr = gmdate(self::SHORT_FORMAT, $newTimestamp);
     $date = new DateTime($dateStr, new DateTimeZone('UTC'));
     $date->setTimezone(new DateTimeZone($this->Timezone()));
     return new Date($date->format(self::SHORT_FORMAT), $this->Timezone());
 }