You are here

public static function DateTime::createFromISO8601 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/DateTime.php \Zend\Stdlib\DateTime::createFromISO8601()

The DateTime::ISO8601 constant used by php's native DateTime object does not allow for fractions of a second. This function better handles ISO8601 formatted date strings.

Parameters

string $time:

DateTimeZone $timezone:

Return value

mixed

Overrides DateTime::createFromISO8601

1 method overrides DateTime::createFromISO8601()
DateTime::createFromISO8601 in vendor/zendframework/zend-stdlib/src/DateTime.php
The DateTime::ISO8601 constant used by php's native DateTime object does not allow for fractions of a second. This function better handles ISO8601 formatted date strings.

File

vendor/zendframework/zend-stdlib/src/DateTime.php, line 34

Class

DateTime
DateTime

Namespace

Zend\Stdlib

Code

public static function createFromISO8601($time, DateTimeZone $timezone = null) {
  $format = self::ISO8601;
  if (isset($time[19]) && $time[19] === '.') {
    $format = 'Y-m-d\\TH:i:s.uO';
  }
  if ($timezone !== null) {
    return self::createFromFormat($format, $time, $timezone);
  }
  return self::createFromFormat($format, $time);
}