DateTimeExtensions extension Dates and times

Useful extensions for working with DateTime objects.

The localized names require intl's locale data. See DateTimeExtensions.dayNameLocalized.

final date = DateTime(2024, 1, 15); // Monday
date.dayNameLocalized(const Locale('fr')); // "lundi"
on

Methods

dayNameLocalized([Locale? locale]) → String

Available on DateTime, provided by the DateTimeExtensions extension

Gets the day name in a specific locale.
dayNameShortLocalized([Locale? locale]) → String

Available on DateTime, provided by the DateTimeExtensions extension

Gets the abbreviated day name in a specific locale.
monthNameLocalized([Locale? locale]) → String

Available on DateTime, provided by the DateTimeExtensions extension

Gets the month name in a specific locale.
monthNameShortLocalized([Locale? locale]) → String

Available on DateTime, provided by the DateTimeExtensions extension

Gets the abbreviated month name in a specific locale.
timeLocalized({Locale? locale, bool use24HourFormat = false}) → String

Available on DateTime, provided by the DateTimeExtensions extension

Gets the time of day in a specific locale.