Novis\Intl\DateFormat
Writes dates and times the way a language and region write them. Each method takes a whole list and a locale tag, such as "de" or "en-GB", and formats the whole list in one call.
Members
3 members.
| Member | Signature |
|---|---|
dateTimes | dateTimes(array<Core\Time\DateTime> $values, string $locale, ?{ length?: Length, fields?: Fields, seconds?: bool, zone?: ZoneStyle } $options = null): array<string> |
dates | dates(array<Core\Time\Date> $values, string $locale, ?{ length?: Length, fields?: Fields } $options = null): array<string> |
times | times(array<Core\Time\TimeOfDay> $values, string $locale, ?{ seconds?: bool } $options = null): array<string> |
Enums
Length { Short, Medium, Long }How long a formatted date is. For March 1, 2026 in English for the United States,Shortwrites "3/1/26".Mediumwrites "Mar 1, 2026". This is the default.Longwrites "March 1, 2026".Longis the longest length. To also show the day of the week, setfieldstoFields::YearMonthDayWeekday.Fields { Day, MonthDay, YearMonthDay, Weekday, DayWeekday, MonthDayWeekday, YearMonthDayWeekday, Month, YearMonth, Year }Which parts of a dateDateFormat::datesandDateFormat::dateTimesshow. Each case is named after the parts it shows. The locale decides the order of the parts. A locale is a language and region, such asen-USordefor German. These examples useLength::Longanden-US.Dayshows the day of the month, such as "5".MonthDayshows the month and the day, such as "January 5".YearMonthDayshows the year, the month and the day, such as "January 5, 2026". This is the default.Weekdayshows the day of the week, such as "Monday".DayWeekdayshows the day of the month and the day of the week, such as "5 Monday".MonthDayWeekdayshows the month, the day and the day of the week, such as "Monday, January 5".YearMonthDayWeekdayshows all four parts, such as "Monday, January 5, 2026".Monthshows the month, such as "January".YearMonthshows the month and the year, such as "January 2026". Inde, this is "Januar 2026".Yearshows the year, such as "2026".Month,YearMonthandYearhave no day. A time of day needs a day, soDateFormat::dateTimesthrows aLogicErrorfor these three cases.ZoneStyle { None, Offset, Location, Generic }HowDateFormat::dateTimesshows the time zone of a date and time.Noneshows no time zone. This is the default.Offsetshows the difference from UTC, such as "GMT+2".Locationshows the country or city of the zone. For the zoneEurope/Vienna, this is "Austria Time".Genericshows the general name of the zone, such as "Central European Time". It does not say whether it is summer time, so the name is the same in summer and in winter.
