/* (non-PHPdoc)
@see n2n\persistence\meta.OrmDialectConfig::parseDateTime()
165900
public function parseDateTime($rawValue) {
		if (null === $rawValue) return null;
		
		try {
			return DateUtils::createDateTimeFromFormat(SqliteDateTimeColumn::FORMAT_DATE_TIME, $rawValue);
		} catch (\n2n\util\DateParseException $e) {
			throw new \InvalidArgumentException($e->getMessage(), 0, $e);
		}
	}
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;
    }
450209
function mdatetime($time = '', $timezone = '', $datetime_format = '') {
		if ($datetime_format == '') {
			$datetime_format = $this->dateFormat . ' ' . $this->timeFormat;
		}
		if ($time == '') {
			$time = 'now';
		}
		if ($timezone == '') {
			$timezone = $this->timeZone;
		}
		$utc = new \DateTimeZone($timezone);
		$dt = new \DateTime($time, $utc);
		return $dt->format($datetime_format);
	}
1369157
private static function parseDateTime(EventDispatcherInterface $dispatcher, $dateFormat, $timeStamp)
    {
        $dateEvent = new ParseDateEvent($timeStamp, $dateFormat);
        $dispatcher->dispatch(ContaoEvents::DATE_PARSE, $dateEvent);

        return $dateEvent->getResult();
    }
72334
private static function parseOneTime(string $time) : array
	{
		$time = static::translateToTimes($time);
		$parts = Strings::split($time, '/\s*-\s*/');
		if (!static::isValidTime($parts[0]) || (isset($parts[1]) && !static::isValidTime($parts[1]))) {
			throw new InvalidParameterException(
				"Times annotation is not in valid format. It must looks like 'hh:mm[ - hh:mm]' but '" . $time . "' was given."
			);
		}
		$times = [];
		if (static::isTimeOverMidnight($parts[0], isset($parts[1]) ? $parts[1] : NULL)) {
			$times[] = static::timePartsToArray('00:00', $parts[1]);
			$times[] = static::timePartsToArray($parts[0], '23:59');
		} else {
			$times[] = static::timePartsToArray($parts[0], isset($parts[1]) ? $parts[1] : NULL);
		}

		return $times;
	}
734415
function parseDate(value) {
  let date = value;
  if (!value) {
    return new Date().getTime();
  }
  if (isObject(date)) {
    date = date.value || date;
  }
  // array
  if (isArray(date)) {
    date = new Date(...date).getTime();
  } else {
    // string number  null 、''、undefined
    date = new Date(date).getTime();
  }
  if (date) {
    return date;
  }
  console.warn('Invalid Date ', value);
  return new Date().getTime();
}
1135107
private function parseTime($time)
    {
        $timezone = $this->config->get('app.timezone', 'UTC');

        /** @var Carbon $now */
        $now = Carbon::now($timezone);

        if (is_object($time)) {
            $deliveryTime = Carbon::instance($time);
        } else {
            if (is_array($time)) {
                reset($time);
                $type = key($time);
                $amount = $time[$type];
            } else {
                $type = 'seconds';
                $amount = $time;
            }

            /** @var Carbon $deliveryTime */
            $deliveryTime = Carbon::now($timezone);

            switch ($type) {
                case 'seconds':
                    $deliveryTime->addSeconds($amount);
                    break;
                case 'minutes':
                    $deliveryTime->addMinutes($amount);
                    break;
                case 'hours':
                    $deliveryTime->addHours($amount);
                    break;
                case 'days':
                    $deliveryTime->addHours($amount * 24);
                    break;
                default:
                    $deliveryTime->addSeconds($amount);
                    break;
            }
        }

        //Calculate boundaries
        $max = Carbon::now()->addHours(3 * 24);
        if ($deliveryTime->gt($max)) {
            $deliveryTime = $max;
        } elseif ($deliveryTime->lt($now)) {
            $deliveryTime = $now;
        }

        return $deliveryTime->format(\DateTime::RFC2822);
    }
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;
        }
    }
653374
function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
  const { setZone, zone } = opts;
  if (parsed && Object.keys(parsed).length !== 0) {
    const interpretationZone = parsedZone || zone,
      inst = DateTime.fromObject(
        Object.assign(parsed, opts, {
          zone: interpretationZone,
          // setZone is a valid option in the calling methods, but not in fromObject
          setZone: undefined
        })
      );
    return setZone ? inst : inst.setZone(zone);
  } else {
    return DateTime.invalid(
      new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
    );
  }
}
1198624
private static function _parseTwoDateTimeStrings($value)
    {
        $dateStrings = explode(',', $value);
        if (count($dateStrings) !== 2)
            return null;

        $timestamps = [];

        foreach ($dateStrings as $dateString) {
            $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d$/', $dateString);
            if ($result !== 1)
                return null;
            $timestamp = strtotime($dateString);
            if ($timestamp === false)
                return null;

            $timestamps[] = $timestamp;
        }
        return $timestamps;
    }
80915
public function setTimeBySqlTimeString ( $timeStr ) {
        if ($this->validTimeStr( $timeStr )) {
            $this->setTime( strtotime( $timeStr ) );
        } else {
            Throw new \InvalidArgumentException( "({$timeStr}) is not a valid time format" );
        }
    }
712735
protected function parseTransactionEntryTimestamp()
    {
        $results = [];
        if (preg_match('/^:61:(\d{2})((\d{2})\d{2})((\d{2})\d{2})[C|D]/', $this->getCurrentTransactionData(), $results)
            && !empty($results[1])
        ) {

            list(, $valueDateY, $valueDateMD, $valueDateM, $entryDateMD, $entryDateM) = $results;
            $entryDate = $valueDateY . $entryDateMD;
            if ($valueDateMD !== $entryDateMD && $valueDateM > $entryDateM) {
                $entryDate = ($valueDateY + 1) . $entryDateMD;
            }

            return $this->sanitizeTimestamp($entryDate);
        }

        return 0;
    }
562870
function parseTimestamp($time) {
        return array(
            (int)date('i',$time),//minute
            (int)date('H',$time),//hour
            (int)date('d',$time),//day of month
            (int)date('m',$time),//month
            (int)date('w',$time),//day of week
        );
    }
733751
private static function _parseDateTimeString($value)
    {
        $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d$/', $value);
        if ($result !== 1)
            return null;
        $timestamp = strtotime($value);
        if ($timestamp === false)
            return null;

        return $timestamp;
    }
173995
public static final synchronized Date parseDateTime(String dateTime) {
		try {
			return dateTimeFormat.parse(dateTime);
		} catch(ParseException e) {
			throw new RuntimeException(e);
		}
	}
907735
public static final Date parseDateTime(String value)
   {
      Date result = null;

      try
      {
         if (value != null && !value.isEmpty())
         {
            result = DATE_TIME_FORMAT.get().parse(value);
         }
      }
      catch (ParseException ex)
      {
         // Ignore
      }

      return result;
   }
1274141
protected function normalizeDateTime($value)
    {
        try {
            if (is_int($value)) {
                //timestamp
                $value = new DateTime("@$value");
            } elseif (!$value instanceof DateTime) {
                $value = new DateTime($value);
            }
        } catch (\Exception $e) {
            throw new InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        return $value;
    }