/** * Converts dateTime from local TZ to UTC * Returns dateTime in format expected by the Outlook API * * @param dateTime $dateTime * @return dateTime */ protected static function encodeDateTime($dateTime) { $utcDateTime = $dateTime->setTimeZone(new \DateTimeZone("UTC")); $dateFormat = "Y-m-d\\TH:i:s\\Z"; return date_format($utcDateTime, $dateFormat); }