---
title: "setSelectedDate"
description: "Sets the [DatePickerState.selectedDateMillis] based on a given [LocalDate].

Converts the [LocalDate] to the start of the day (midnight) in UTC and apply it to the
[DatePickerState] `selectedDateMillis`. Setting `null` clears the selection."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-jvmAndAndroid'>JvmAndAndroid</div>


```kotlin
@RequiresApi(26)
fun DatePickerState.setSelectedDate(date: LocalDate?)
```


Sets the `DatePickerState.selectedDateMillis` based on a given `LocalDate`.

Converts the `LocalDate` to the start of the day (midnight) in UTC and apply it to the
`DatePickerState` `selectedDateMillis`. Setting `null` clears the selection.

#### Parameters

| | |
| --- | --- |
| date | The `LocalDate` to select, or `null` to clear the selection. |




