title: DatePicker(UIDatePicker) date format
body: <p>Is there a way to set the date format of the <code>DatePicker</code> (UIDatePicker)?</p>
  <p>You can set the <code>Locale</code> and that would result in changing of the date format, but what if you would like to set a <code>en_CA</code> locale but instead of the default <code>Jan 3, 2022</code> format you would want <code>2022-01-03</code>.</p>
  <p>My setup is in SwiftUI, but I guess the same approach would likely work for UIKit/SwiftUI.</p>
  <pre><code>            DatePicker(
                  &quot;My date&quot;,
                  selection: $date,
                  in: ...Date(),
                  displayedComponents: [.date]
              )
              .frame(alignment: .leading)
              .labelsHidden()
              .id(date) // hack, see https://stackoverflow.com/a/68120390/429763
              .environment(\.locale, Locale.init(identifier: &quot;en_CA&quot;))
              .onChange(of: date) { date in
                  Log(&quot;On change date: \(date)&quot;)
              }
  </code></pre>