Lines Matching defs:timestamp
406 public static function parseTimestamp($timestamp)
410 if (substr($timestamp, 0, 4) === "0000") {
414 if (substr($timestamp, -1, 1) === "z") {
419 $periodIndex = strpos($timestamp, ".");
422 // find the next non-numeric character in the timestamp to calculate
424 for ($i = $periodIndex + 1, $length = strlen($timestamp); $i < $length; $i++) {
425 if (!is_numeric($timestamp[$i])) {
437 $nanoseconds = substr($timestamp, $periodIndex + 1, $nanosecondsLength);
440 // remove the nanoseconds and preceding period from the timestamp
441 $date = substr($timestamp, 0, $periodIndex);
442 $timezone = substr($timestamp, $periodIndex + $nanosecondsLength + 1);
443 $timestamp = $date.$timezone;
447 $date = \DateTime::createFromFormat(\DateTime::RFC3339, $timestamp, new \DateTimeZone("UTC"));
449 throw new \Exception("Invalid RFC 3339 timestamp.");