private function calculateMilestoneDueDate($milestonePoints) { $secsTranspired = ceil($milestonePoints / $this->ptsPerSecond); $intervalSeconds = "PT" . $secsTranspired . "S"; $sDate = clone $this->startDateUTC; $dueDate = $sDate->add(new \DateInterval($intervalSeconds)); //set to user's timezone $localDate = Utils::setLocalTimezone($dueDate); return $localDate; }
public function convertDatesUTCLocal() { $utcTime = Utils::convertLocalDateTimeToUTC(new DateTime('now')); echo "UTC:" . json_encode($utcTime); $localTime = Utils::convertUTCDateTimetoLocal($utcTime); echo "MOUNTAIN" . json_encode($localTime); }
public function setEndDateAttribute($value) { //first convert it to local so it has the right timezone property. Then save it in UTC to the DB $date = Utils::setLocalTimezone($value); $this->attributes['end_date'] = Utils::setUTCTimezone($date); }