/* (non-PHPdoc)
@see n2n\persistence\meta.OrmDialectConfig::parseDateTime()
326561
public function parseDateTime($rawValue) {
		if (null === $rawValue) {
			return null;
		}
		
		try {
			$dateTime = DateUtils::createDateTimeFromFormat(MysqlDateTimeColumn::FORMAT_DATE_TIME, $rawValue);
			if ($dateTime->getTimestamp() === false) {
				throw new DateParseException('Invalid datetime raw value: ' . $rawValue);
			}
			return $dateTime;
		} catch (\n2n\util\DateParseException $e) {
			throw new \InvalidArgumentException($e->getMessage(), 0, $e);
		}
	}
1227580
public function dtsToYymmdd($dtsDateTime)
    {
        $inputFormat = "*DTS"; // special system format, returned by some APIs.
        $outputFormat = "*YYMD"; // 17 chars long
        $outputVarname = 'datetimeOut';

        $apiPgm = 'QWCCVTDT';
        $apiLib = 'QSYS';

        $paramXml = "<parm io='in' comment='1. Input format'>
            <data var='formatIn' type='10A' comment='*DTS is system time stamp format'>$inputFormat</data>
            </parm>
            <parm io='in' comment='2. Input variable'>
            <data var='datetimeIn' type='8b'  comment='*DTS format is type 8b (binary)'>$dtsDateTime</data>
            </parm>
            <parm io='in' comment='3. Output format'>
            <data var='formatOut' type='10A' comment='*YYMD means YYYYMMDDHHMMSSmmm (milliseconds)'>$outputFormat</data>
            </parm>
            <parm io='out' comment='4. Output variable'>
            <ds var='$outputVarname' comment='Data structure, total of 17 bytes, to split date/time into YYYYMMDD, HHMMSS, and microseconds, as indicated by *YYMD format'>
            <data var='date' type='8a' comment='YYYYMMDD' />
            <data var='time' type='6a' comment='HHMMSS' />
            <data var='microseconds' type='3a' comment='microsecs (3 digits)' />
            </ds>
            </parm>\n" .
            Toolkit::getErrorDataStructXml(5); // param number 5

        // pass param xml directly in.
        $retPgmArr = $this->ToolkitSrvObj->PgmCall($apiPgm, $apiLib, $paramXml);
        if ($this->ToolkitSrvObj->getErrorCode()) {
            return false;
        }

        $retArr = $retPgmArr['io_param'][$outputVarname];

        return $retArr;
    }
1177143
@MapMethod
    public Date parseDate(String d, String format){
        return Objects.parseDate(d,format);
    }
457935
public static function parseTime($timeSpan)
    {
        $times = array('s' => 1, 'm' => 60, 'h' => 3600, 'd' => 86400, 'w' => 604800);
        $matches = array();
        if (is_numeric($timeSpan)) {
            return $timeSpan;
        }
        if (preg_match('/^((\d+)?(\.\d+)?)('.implode('|', array_keys($times)).')$/',
                $timeSpan, $matches)) {
            return floatval($matches[1]) * $times[$matches[4]];
        }
        return null;
    }
678357
public function parseDateTime($rawValue) {
		if (null === $rawValue) return null;
		
		try {
			return DateUtils::createDateTimeFromFormat(OracleDateTimeColumn::generateFormatBuildRawValue(
					OracleDateTimeColumn::FORMAT_BUILD_TYPE_PARSE, true, true), $rawValue);
		} catch (\n2n\util\DateParseException $e) {
			throw new \InvalidArgumentException($e->getMessage(), 0, $e);
		}
	}
922937
private long parseDateTime(String str, String format)
    {
        return FormatUtilities.getDateTime(str, format, false, true);
    }
1276793
private DateTime parseToDate(String toDate) {
        // Default to now
        return parseDate(toDate, new DateTime().withZone(DateTimeZone.UTC), false);
    }
442564
private static function validateDateTime($datetime)
	    {
	        if ($datetime instanceof DateTimeInterface || $datetime instanceof DateTime) {
	            return $datetime;
	        }

	        return new DateTime((string) $datetime);
	    }
896520
public static function parseDate(string $date): ?\DateTimeImmutable
    {
        if (preg_match('/^\d{4}$/', $date)) {
            return \DateTimeImmutable::createFromFormat('!Y-m-d', $date.'-01-01', new \DateTimeZone('UTC'));
        }

        if (preg_match('/(\w{3}), (\d{4})/', $date, $matches)) {
            return \DateTimeImmutable::createFromFormat(
                '!M d, Y',
                "{$matches[1]} 01, {$matches[2]}",
                new \DateTimeZone('UTC')
            );
        }

        try {
            return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
        } catch (\Exception $e) {
            return null;
        }
    }
1254605
function _decodeTime($content, $tag)
    {
        /* UTCTime:
           http://tools.ietf.org/html/rfc5280#section-4.1.2.5.1
           http://www.obj-sys.com/asn1tutorial/node15.html

           GeneralizedTime:
           http://tools.ietf.org/html/rfc5280#section-4.1.2.5.2
           http://www.obj-sys.com/asn1tutorial/node14.html */

        $format = 'YmdHis';

        if ($tag == self::TYPE_UTC_TIME) {
            // https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=28 says "the seconds
            // element shall always be present" but none-the-less I've seen X509 certs where it isn't and if the
            // browsers parse it phpseclib ought to too
            if (preg_match('#^(\d{10})(Z|[+-]\d{4})$#', $content, $matches)) {
                $content = $matches[1] . '00' . $matches[2];
            }
            $prefix = substr($content, 0, 2) >= 50 ? '19' : '20';
            $content = $prefix . $content;
        } elseif (strpos($content, '.') !== false) {
            $format.= '.u';
        }

        if ($content[strlen($content) - 1] == 'Z') {
            $content = substr($content, 0, -1) . '+0000';
        }

        if (strpos($content, '-') !== false || strpos($content, '+') !== false) {
            $format.= 'O';
        }

        // error supression isn't necessary as of PHP 7.0:
        // http://php.net/manual/en/migration70.other-changes.php
        return @DateTime::createFromFormat($format, $content);
    }
117395
protected function _convertTime($fullDate)
    {
        $date = substr($fullDate, 0, 10);
        $convertedObject = new \OxidEsales\Eshop\Core\Field();
        $convertedObject->setValue($date);
        \OxidEsales\Eshop\Core\Registry::getUtilsDate()->convertDBDate($convertedObject, true);
        $stringModifier = getStr();

        // looking for time field
        $time = substr($fullDate, 11);
        if ($stringModifier->preg_match("/([0-9]{2}):([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
            if ($timeMatches[3] == "PM") {
                $intVal = (int)$timeMatches[1];
                if ($intVal < 13) {
                    $time = ($intVal + 12) . ":" . $timeMatches[2];
                }
            } else {
                $time = $timeMatches[1] . ":" . $timeMatches[2];
            }
        } elseif ($stringModifier->preg_match("/([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
            if ($timeMatches[2] == "PM") {
                $intVal = (int)$timeMatches[1];
                if ($intVal < 13) {
                    $time = ($intVal + 12);
                }
            } else {
                $time = $timeMatches[1];
            }
        } else {
            $time = str_replace(".", ":", $time);
        }

        return $convertedObject->value . " " . $time;
    }
82831
func ParseDatetime(str string) (Time, error) {
	return ParseTime(str, mysql.TypeDatetime, DefaultFsp)
}
1027116
function _format_date_time( $datetime, $parno=6 ) {
    if( !isset( $datetime['year'] )  &&
        !isset( $datetime['month'] ) &&
        !isset( $datetime['day'] )   &&
        !isset( $datetime['hour'] )  &&
        !isset( $datetime['min'] )   &&
        !isset( $datetime['sec'] ))
      return ;
    $output = null;
    $output = date('Ymd', mktime( 0, 0, 0
                                 , (integer) $datetime['month']
                                 , (integer) $datetime['day']
                                 , (integer) $datetime['year']));
    if( isset( $datetime['hour'] )  ||
        isset( $datetime['min'] )   ||
        isset( $datetime['sec'] )   ||
        isset( $datetime['tz'] )) {
      if( isset( $datetime['tz'] )  &&
         !isset( $datetime['hour'] ))
        $datetime['hour'] = '0';
      if( isset( $datetime['hour'] )  &&
         !isset( $datetime['min'] ))
        $datetime['min'] = '0';
      if( isset( $datetime['hour'] )  &&
          isset( $datetime['min'] )   &&
         !isset( $datetime['sec'] ))
        $datetime['sec'] = '0';
      foreach( $datetime as $dkey => $dvalue ) {
        if( 'tz' != $dkey )
          $datetime[$dkey] = (integer) $dvalue;
      }
      $output .= date('\THis', mktime( $datetime['hour']
                                      , $datetime['min']
                                      , $datetime['sec']
                                      , $datetime['month']
                                      , $datetime['day']
                                      , $datetime['year']));
      if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) {
        $datetime['tz'] = trim( $datetime['tz'] );
        if( 'Z' == $datetime['tz'] )
          $output .= 'Z';
        $offset = 0;
        $offset = $this->_tz2offset( $datetime['tz'] );
        if( 0 != $offset ) {
          $output    = date('Ymd\THis\Z', mktime( $datetime['hour']
                                                 , $datetime['min']
                                                 , $datetime['sec'] + $offset
                                                 , $datetime['month']
                                                 , $datetime['day']
                                                 , $datetime['year']));
        }
      }
      elseif( 7 == $parno )
        $output .= 'Z';
    }
    return $output;
  }
499403
public function parseDate($string)
    {
        try {
            return new \DateTime($string);
        } catch (ParsingException $ex) {
            $exception = new ParsingException('The date is '
                      . 'not parsable', 0, $ex);
            throw $exception;
        }
        
    }
1265821
protected static function _ParseTime ($name) {
		if (!isset(static::$_stopwatchLog[$name])) {
			return null;
		}
		$log = static::$_stopwatchLog[$name];
		$ret = array();
		if (isset($log['start'])) {
			$ret['start'] = sprintf('%F', $log['start']);
		}
		if (isset($log['split']) && is_array($log['split'])) {
			foreach ($log['split'] as $split) {
				$ret['split'][] = sprintf('%F', $split);
			}
		}
		if (isset($log['stop'])) {
			$ret['stop'] = sprintf('%F', $log['stop']);
		}
		return $ret;
	}
1092700
protected function getDateTime($value)
    {
        try {
            if ($this->isTestingRelativeDateTime($value)) {
                return Date::parse($value);
            }

            return new DateTime($value);
        } catch (Exception $e) {
            //
        }
    }
1208406
protected function parseTransactionValueTimestamp()
    {
        $results = [];
        if (preg_match(self::PATTERN_TAG_61, $this->getCurrentTransactionData(), $results)) {
            return $this->sanitizeTimestamp($results[1]);
        }

        return 0;
    }