/** * Returns dateTime parsed by custom format (string provided in parameter). * * Format must obey syntax defined in CLDR specification, excluding * unimplemented features (see documentation for DatesReader class). * * Format is remembered in cache and won't be parsed again for some time. * * @param string $datetimeToParse Date/time to be parsed * @param string $format Format string * @param \TYPO3\FLOW3\I18n\Locale $locale A locale used for finding literals array * @param boolean $strictMode Work mode (strict when TRUE, lenient when FALSE) * @return mixed Array of parsed date / time elements, FALSE on failure * @api * @see \TYPO3\FLOW3\I18n\Cldr\Reader\DatesReader */ public function parseDatetimeWithCustomPattern($datetimeToParse, $format, \TYPO3\FLOW3\I18n\Locale $locale, $strictMode = TRUE) { return $this->doParsingWithParsedFormat($datetimeToParse, $this->datesReader->parseCustomFormat($format), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
/** * Returns dateTime formatted by custom format, string provided in parameter. * * Format must obey syntax defined in CLDR specification, excluding * unimplemented features (see documentation for DatesReader class). * * Format is remembered in this classes cache and won't be parsed again for * some time. * * @param \DateTime $dateTime PHP object representing particular point in time * @param string $format Format string * @param \TYPO3\FLOW3\I18n\Locale $locale A locale used for finding literals array * @return string Formatted date / time. Unimplemented subformats in format string will be silently ignored * @api * @see \TYPO3\FLOW3\I18n\Cldr\Reader\DatesReader */ public function formatDateTimeWithCustomPattern(\DateTime $dateTime, $format, \TYPO3\FLOW3\I18n\Locale $locale) { return $this->doFormattingWithParsedFormat($dateTime, $this->datesReader->parseCustomFormat($format), $this->datesReader->getLocalizedLiteralsForLocale($locale)); }