<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDatePicker/setDate(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDatePicker(im)setDate:animated:"
  },
  "title" : "setDate(_:animated:)"
}
-->

# setDate(_:animated:)

Sets the date to display in the date picker, with an option to animate the setting.

```
func setDate(_ date: Date, animated: Bool)
```

## Parameters

`date`

An `NSDate` object representing the new date to display in the date picker.

`animated`

<doc://com.apple.documentation/documentation/Swift/true> to animate the setting of the new date, otherwise <doc://com.apple.documentation/documentation/Swift/false>. The animation rotates the wheels until the new date and time is shown under the highlight rectangle.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)