Interface

DatePickerFormatter

A date formatter interface used by DatePicker.

Source set: Common
public interface DatePickerFormatter

A date formatter interface used by DatePicker.

Functions

formatMonthYear

Source set: Common
public fun formatMonthYear(
        @Suppress("AutoBoxing") monthMillis: Long?,
        locale: CalendarLocale,
    ): String?

Format a given monthMillis to a string representation of the month and the year (i.e. January 2023).

Parameters

monthMillis timestamp in UTC milliseconds from the epoch that represents the month
locale a CalendarLocale to use when formatting the month and year

formatDate

Source set: Common
public fun formatDate(
        @Suppress("AutoBoxing") dateMillis: Long?,
        locale: CalendarLocale,
        forContentDescription: Boolean = false,
    ): String?

Format a given dateMillis to a string representation of the date (i.e. Mar 27, 2021).

Parameters

dateMillis timestamp in UTC milliseconds from the epoch that represents the date
locale a CalendarLocale to use when formatting the date
forContentDescription indicates that the requested formatting is for content description. In these cases, the output may include a more descriptive wording that will be passed to a screen readers.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: