# DatePickerFormatter

Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/DatePicker.kt+class:androidx.compose.material3.DatePickerFormatter) Common/AllAndroid/JVM
- Cmn

  ```
  interface DatePickerFormatter
  ```

*** ** * ** ***

A date formatter interface used by `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePicker.composable#DatePicker(androidx.compose.material3.DatePickerState,androidx.compose.ui.Modifier,androidx.compose.material3.DatePickerFormatter,androidx.compose.material3.DatePickerColors,kotlin.Function0,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.focus.FocusRequester)`.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatDate(kotlin.Long,androidx.compose.material3.CalendarLocale,kotlin.Boolean)( dateMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html?, locale: https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale, forContentDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Format a given `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatDate(kotlin.Long,androidx.compose.material3.CalendarLocale,kotlin.Boolean)` to a string representation of the date (i.e. Mar 27, 2021). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatMonthYear(kotlin.Long,androidx.compose.material3.CalendarLocale)(monthMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html?, locale: https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale)` Format a given `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatMonthYear(kotlin.Long,androidx.compose.material3.CalendarLocale)` to a string representation of the month and the year (i.e. January 2023). | Cmn |

## Public functions

### formatDate

Cmn

```
fun formatDate(
    dateMillis: Long?,
    locale: CalendarLocale,
    forContentDescription: Boolean = false
): String?
```

Format a given `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatDate(kotlin.Long,androidx.compose.material3.CalendarLocale,kotlin.Boolean)` to a string representation of the date (i.e. Mar 27, 2021).

| Parameters |
|---|---|
| `dateMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html?` | timestamp in *UTC* milliseconds from the epoch that represents the date |
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale` | a `https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale` to use when formatting the date |
| `forContentDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | 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. |

### formatMonthYear

Cmn

```
fun formatMonthYear(monthMillis: Long?, locale: CalendarLocale): String?
```

Format a given `https://developer.android.com/reference/kotlin/androidx/compose/material3/DatePickerFormatter#formatMonthYear(kotlin.Long,androidx.compose.material3.CalendarLocale)` to a string representation of the month and the year (i.e. January 2023).

| Parameters |
|---|---|
| `monthMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html?` | timestamp in *UTC* milliseconds from the epoch that represents the month |
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale` | a `https://developer.android.com/reference/kotlin/androidx/compose/material3/CalendarLocale` to use when formatting the month and year |