Get date formatter with the standard locale / date format

@throws \LogicException
@return IntlDateFormatter
173337
protected function getFrontendFormatter()
    {
        if ($this->getHTML5() && $this->dateFormat && $this->dateFormat !== DBDate::ISO_DATE) {
            throw new \LogicException(
                'Please opt-out of HTML5 processing of ISO 8601 dates via setHTML5(false) if using setDateFormat()'
            );
        }

        if ($this->getHTML5() && $this->dateLength) {
            throw new \LogicException(
                'Please opt-out of HTML5 processing of ISO 8601 dates via setHTML5(false) if using setDateLength()'
            );
        }

        if ($this->getHTML5() && $this->locale && $this->locale !== DBDate::ISO_LOCALE) {
            throw new \LogicException(
                'Please opt-out of HTML5 processing of ISO 8601 dates via setHTML5(false) if using setLocale()'
            );
        }

        $formatter = IntlDateFormatter::create(
            $this->getLocale(),
            $this->getDateLength(),
            IntlDateFormatter::NONE
        );

        if ($this->getHTML5()) {
            // Browsers expect ISO 8601 dates, localisation is handled on the client
            $formatter->setPattern(DBDate::ISO_DATE);
        } elseif ($this->dateFormat) {
            // Don't invoke getDateFormat() directly to avoid infinite loop
            $ok = $formatter->setPattern($this->dateFormat);
            if (!$ok) {
                throw new InvalidArgumentException("Invalid date format {$this->dateFormat}");
            }
        }
        return $formatter;
    }
1270406
public function getPrettyString()
    {
        $out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString()));
        return $out;
    }
169693
public function getTimeFormat()
    {
        if ($this->getHTML5()) {
            // Browsers expect ISO 8601 times, localisation is handled on the client
            $this->setTimeFormat(DBTime::ISO_TIME);
        }

        if ($this->timeFormat) {
            return $this->timeFormat;
        }

        // Get from locale
        return $this->getFrontendFormatter()->getPattern();
    }
229933
protected function getNumberFormatter()
    {
        $formatter = new \NumberFormatter($this->locale ?? \Locale::getDefault(), \NumberFormatter::DECIMAL);

        if (null !== $this->scale) {
            $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->scale);
            $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
        }

        $formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);

        return $formatter;
    }
729915
private function getFormatter($locale = 'de-AT')
    {
        $formatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
        $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 2);
        $formatter->setAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1);

        return $formatter;
    }
1062168
function toDate()
    {
        $date = new eZDate( $this->DateTime );
        $date->setLocale( $this->Locale );
        return $date;
    }
540814
protected function getDateFormat(): string
	{
		static $dateFormat;

		if($dateFormat === null)
		{
			$dateFormat = $this->builder()->getCompiler()->getDateFormat();
		}

		return $dateFormat;
	}
1209101
static function getLocaleDateFormat($in_format)
    {

        $out_format = $in_format;
        if ($in_format == "%d/%m/%Y") {
            $out_format = "d-m-Y";
        }

        if ($in_format == "%Y/%m/%d") {
            $out_format = "Y-m-d";
        }

        if ($in_format == "%m/%Y/%d") {
            $out_format = "m-Y-d";
        }

        if ($in_format == "%d-%m-%Y") {
            $out_format = "d-m-Y";
        }

        if ($in_format == "%Y-%m-%d") {
            $out_format = "Y-m-d";
        }

        if ($in_format == "%m-%Y-%d") {
            $out_format = "m-Y-d";
        }

        if (!$in_format) {
            $in_format = "d-m-Y";
        }

        return ($out_format);
    }
677403
public function getFormatter()
    {
        $fmt = $this->settings->format;
        $formatter = null;
        if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
            $formatter = clone $fmt;
        } elseif ($fmt === 'html') {
            $formatter = new HtmlFormatter();
        } elseif ($fmt ===  'html-inline') {
            $formatter = new InlineHtmlFormatter();
        } elseif ($fmt ===  'html-full') {
            $formatter = new FullPageHtmlFormatter();
        } elseif ($fmt === 'latex') {
            $formatter = new LatexFormatter();
        } elseif ($fmt === 'ansi') {
            $formatter = new AnsiFormatter();
        } elseif ($fmt ===  null || $fmt === 'none') {
            $formatter = new IdentityFormatter();
        }

        if ($formatter === null) {
            throw new Exception('Unknown formatter: ' . $this->settings->format);
            return null;
        }
        $this->setFormatterOptions($formatter);
        return $formatter;
    }
267682
protected function getDateFormatter($dateFormat, $timeFormat, $calendar)
    {
        $datetype = isset($dateFormat) ? $this->getFormat($dateFormat) : null;
        $timetype = isset($timeFormat) ? $this->getFormat($timeFormat) : null;

        $calendarConst = $calendar === 'traditional' ? \IntlDateFormatter::TRADITIONAL : \IntlDateFormatter::GREGORIAN;
        
        $pattern = $this->getDateTimePattern(
            isset($datetype) ? $datetype : $dateFormat,
            isset($timetype) ? $timetype : $timeFormat,
            $calendarConst
        );
        
        return new \IntlDateFormatter(\Locale::getDefault(), $datetype, $timetype, null, $calendarConst, $pattern);
    }
430701
public function getMetaDateFormat()
    {
        if ($format = $this->owner->config()->meta_date_format) {
            return $format;
        }
        
        return Config::inst()->get(self::class, 'default_meta_date_format');
    }
680173
public DateTimeInterpreter getDateTimeInterpreter() {
        if (mDateTimeInterpreter == null) {
            mDateTimeInterpreter = new DateTimeInterpreter() {
                @Override
                public String interpretDate(Calendar date) {
                    try {
                        SimpleDateFormat sdf = mDayNameLength == LENGTH_SHORT ? new SimpleDateFormat("EEEEE M/dd", Locale.getDefault()) : new SimpleDateFormat("EEE M/dd", Locale.getDefault());
                        return sdf.format(date.getTime()).toUpperCase();
                    } catch (Exception e) {
                        e.printStackTrace();
                        return "";
                    }
                }

                @Override
                public String interpretTime(int hour) {
                    Calendar calendar = Calendar.getInstance();
                    calendar.set(Calendar.HOUR_OF_DAY, hour);
                    calendar.set(Calendar.MINUTE, 0);

                    try {
                        SimpleDateFormat sdf = DateFormat.is24HourFormat(getContext()) ? new SimpleDateFormat("HH:mm", Locale.getDefault()) : new SimpleDateFormat("hh a", Locale.getDefault());
                        return sdf.format(calendar.getTime());
                    } catch (Exception e) {
                        e.printStackTrace();
                        return "";
                    }
                }
            };
        }
        return mDateTimeInterpreter;
    }
284842
protected function getNumberFormatter()
    {
        $formatter = new \NumberFormatter($this->locale, \NumberFormatter::DECIMAL);

        if (null !== $this->precision) {
            $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->precision);
            $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
        }

        $formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);

        return $formatter;
    }
321584
protected function formatter()
    {
        $key = $this->getLocalesKey(
            $locale = $this->getLocale(),
            $fallbackLocale = $this->getFallbackLocale()
        );

        if (! isset($this->formatters[$key])) {
            $this->formatters[$key] = new CurrencyFormatter(
                new NumberFormatRepository($fallbackLocale),
                $this->data(),
                ['locale' => $locale]
            );
        }

        return $this->formatters[$key];
    }
1165831
private function determineDateFormat()
    {
        if ($format = \trim($this->get('dateformat'))) {
            return $format;
        }

        return Date::getFormatFromRgxp($this->get('timetype'));
    }
1222196
protected function getFormatter()
    {
        // Get formatter
        $format = LineFormatter::SIMPLE_FORMAT;
        if (!Director::is_cli()) {
            $format = "<p>$format</p>";
        }
        return Injector::inst()->createWithArgs(
            LineFormatter::class,
            array($format)
        );
    }
1169003
protected function getInternalFormatter($timezone = null)
    {
        if (!$timezone) {
            $timezone = date_default_timezone_get(); // Default to server timezone
        }

        $formatter = IntlDateFormatter::create(
            DBDate::ISO_LOCALE,
            IntlDateFormatter::MEDIUM,
            IntlDateFormatter::MEDIUM,
            $timezone
        );
        $formatter->setLenient(false);

        // Note we omit timezone from this format, and we always assume server TZ
        $formatter->setPattern(DBDatetime::ISO_DATETIME);

        return $formatter;
    }