/** * @return int */ public function TotalSeconds() { if ($this->interval != null) { return $this->interval->TotalSeconds(); } return 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()); }