Formats any date into date('j \d\e F \d\e Y')

NOTES:
- The first day of the month is '1º'
- The month is in Portuguese

@param string $date Any English textual datetime description

@return string

@see http://php.net/manual/en/datetime.formats.date.php
502388
public static function date($date)
    {
        $d = explode('/', date('j/n/Y', strtotime($date)));
        if ($d[0] == '1') {
            $d[0] .= 'º';
        }
        $d[1] = self::MONTHS[$d[1] - 1];
        return implode(' de ', $d);
    }
195709
public static String
format(Date date) {
	Calendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
	StringBuffer sb = new StringBuffer();

	c.setTime(date);
	sb.append(w4.format(c.get(Calendar.YEAR)));
	sb.append(w2.format(c.get(Calendar.MONTH)+1));
	sb.append(w2.format(c.get(Calendar.DAY_OF_MONTH)));
	sb.append(w2.format(c.get(Calendar.HOUR_OF_DAY)));
	sb.append(w2.format(c.get(Calendar.MINUTE)));
	sb.append(w2.format(c.get(Calendar.SECOND)));
	return sb.toString();
}
818137
public function getUserDate($date)
    {
        $date = DBDatetime::create()->setValue($date);
        $member = Security::getCurrentUser();
        return $date->FormatFromSettings($member);
    }
1054480
public function translateMonths(string $date)
    {
        foreach (array_flip($this->getMonthTranslationMap()) as $translated => $english) {
            if (false !== strpos($date, $english)) {
                $date = str_replace($english, $translated, $date);
            }
        }

        foreach (array_flip($this->getShortMonthTranslationMap()) as $translated => $english) {
            if (false !== strpos($date, $english)) {
                $date = str_replace($english, $translated, $date);
            }
        }

        return $date;
    }
156415
public function matchDate($date)
    {
        return $this->matchPart(
            $date,
        $this->formatRegex[$this->format][self::STRDATE]
        );
    }
971102
protected function getFormatedDate($date)
    {
        if (! is_null($date)) {
            if (! ($date instanceof Carbon)) {
                $date = Carbon::parse($date);
            }

            $date = $date->timezone($this->getTimezone())->format($this->getFormat());
        }

        return $date;
    }
1222286
public function prettyDate($date, $format = null)
    {
        if (is_string($date)) {
            $date = new \DateTime($date);
        }

        if (null !== $format) {
            return $this->dateFormatter->prettyDate($date, $format);
        }

        return $this->dateFormatter->prettyDate($date);
    }
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
1322892
public static function displayDateTime($date)
    {
        $namaBulan  = $this->monthList();
        $dateInt    = $this->splitDate($date);
        $dateString = $this->splitDate($date, 'string');

        return $namaBulan[$dateInt['month']] . ' ' . $dateInt['date'] . ', ' . $dateInt['year'] . ' ' . $dateString['hour'] . ':' . $dateString['minute'] . ':' . $dateString['second'];
    }
113668
function formatDate ( date ) {
			return weekdays[date.getDay()] + ", " +
				date.getDate() + nth(date.getDate()) + " " +
				months[date.getMonth()] + " " +
				date.getFullYear();
		}
652836
protected static function _strftime($format, $date) {
		$format = strftime($format, $date);
		$encoding = Configure::read('App.encoding');

		if (!empty($encoding) && $encoding === 'UTF-8') {
			$valid = mb_check_encoding($format, $encoding);
			if (!$valid) {
				$format = utf8_encode($format);
			}
		}
		return $format;
	}
1287265
public function date_asctime($date)
	{
		static $pcre;
		if (!$pcre)
		{
			$space = '[\x09\x20]+';
			$wday_name = $this->day_pcre;
			$mon_name = $this->month_pcre;
			$day = '([0-9]{1,2})';
			$hour = $sec = $min = '([0-9]{2})';
			$year = '([0-9]{4})';
			$terminator = '\x0A?\x00?';
			$pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
		}
		if (preg_match($pcre, $date, $match))
		{
			/*
			Capturing subpatterns:
			1: Day name
			2: Month
			3: Day
			4: Hour
			5: Minute
			6: Second
			7: Year
			*/

			$month = $this->month[strtolower($match[2])];
			return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
		}

		return false;
	}
1322742
public static function human($date, $format = 'l, M j'): string
    {
        $diff = self::parse(Date('Y-m-d'))->diffInDays(self::parse($date), false);
        if ($diff == 0) {
            return 'Today';
        } elseif ($diff == 1) {
            return 'Tomorrow';
        } elseif ($diff == -1) {
            return 'Yesterday';
        } elseif ($diff > 0 && $diff < 7) {
            return self::parse($date)->format('l');
        } elseif ($diff < 0 && $diff > -7) {
            return 'last ' . self::parse($date)->format('l');
        } else {
            return self::parse($date)->format($format);
        }
    }
203428
public static function convertDate($date)
    {
        if (\is_int($date)) {
            $timestamp = $date;
        } else {
            $timestamp = \strtotime($date);
        }
        $string = \date('Y-m-d\TH:i:s\Z', $timestamp);

        return $string;
    }
521074
function(date, format) {
            var i, replacements,
                locale = locale_name();
            if(format && locale_uses_day_before_month()) {
                replacements = this.DAY_FIRST_FORMATS;
                for(i = 0; i < replacements.length; i++) {
                    format = format.replace(replacements[i][0], replacements[i][1]);
                }
            }
            if(format && locale in this.CUSTOM_LOCALE_FORMATS) {
                replacements = this.CUSTOM_LOCALE_FORMATS[locale];

                for(i = 0; i < replacements.length; i++) {
                    format = format.replace(replacements[i][0], replacements[i][1]);
                }
            }
            return format_date(date, format);
        }
717374
public function date($date, $format = null)
    {
        if ($this->isEmptyDate($date)) {
            return '';
        }

        $isLocalizerFormat = in_array($format, [Localizer::SHORT, Localizer::LONG, Localizer::VERBOSE]);

        if ($format && !$isLocalizerFormat) {
            return $this->toDateTime($date)->format($format);
        }

        if (!$this->localizer) {
            return $this->toDateTime($date)->format('Y-m-d');
        }

        return $this->localizer->date($date, $format ?: Localizer::SHORT);
    }
166149
protected function date_format($date)
    {
        if (empty($date)) {
            return null;
        }

        if (!is_object($date) || !is_a($date, 'DateTime')) {
            try {
                $timestamp = rcube_utils::strtotime($date);
                $date      = new DateTime("@".$timestamp);
            }
            catch (Exception $e) {
                return null;
            }
        }

        return $date->format('d-M-Y H:i:s O');
    }