Skip to content

Novis\Intl\DateFormat::Length

How long a date is when DateFormat writes it.

DateFormat::Length is declared in the class Novis\Intl\DateFormat.

You pass a DateFormat::Length to DateFormat::dates or DateFormat::dateTimes as length. In English for the United States, the same day is:

  • Short: "3/1/26", only digits.
  • Medium: "Mar 1, 2026", with a short month name. This is the default.
  • Long: "March 1, 2026", with the full month name.

Each locale has its own patterns, so the order of day, month and year follows the locale.

Good to know: a Short date can be read in two ways by people from different countries. Use Medium or Long when the reader's locale is not certain.

Examples

Short medium long dates

<?nvs
// Shows one date written with each `DateFormat::Length`, in English for the United States.
use Novis\Intl\DateFormat;
array<Core\Time\Date> $dates = [Core\Time\Date::at(2026, 3, 1)];
// `Medium` is the default.
echo DateFormat::dates($dates, 'en-US', { length: DateFormat::Length::Short })[0], "\n";
echo DateFormat::dates($dates, 'en-US', { length: DateFormat::Length::Medium })[0], "\n";
echo DateFormat::dates($dates, 'en-US', { length: DateFormat::Length::Long })[0], "\n";
Output
3/1/26
Mar 1, 2026
March 1, 2026