コード例 #1
0
 static function fromIsoString($str)
 {
     $dotPos = _hx_index_of($str, ".", null);
     $zPos = _hx_index_of($str, "Z", null);
     if (ord(substr($str, strlen($str) - 1, 1)) !== 90) {
         throw new HException("`" . _hx_string_or_null($str) . "` - incorrect date/time format. Not an ISO 8601 UTC/Zulu string: Z not found.");
     }
     if (strlen($str) > 20) {
         if (ord(substr($str, 19, 1)) !== 46) {
             throw new HException("`" . _hx_string_or_null($str) . "` - incorrect date/time format. Not an ISO 8601 string: Millisecond specification erroneous.");
         }
         if (ord(substr($str, 23, 1)) !== 90) {
             throw new HException("`" . _hx_string_or_null($str) . "` - incorrect date/time format. Not an ISO 8601 string: Timezone specification erroneous.");
         }
     }
     return datetime_utils_DateTimeUtils::parse(_hx_string_or_null(_hx_substr($str, 0, 10)) . " " . _hx_string_or_null(_hx_substr($str, 11, 8)));
 }