Setting TimeZone in DatePicker (Android)

前端 未结 3 434
日久生厌
日久生厌 2021-01-16 09:34

I\'m using DatePicker in my Android Application to display available dates that the user can pick. I want to display the dates in the GMT Time Zone so that all users see the

3条回答
  •  孤城傲影
    2021-01-16 10:18

    You specify setMinDate and setMaxDate with a long primitive. There is no way to include a specific timezone during the assignment. The method will always use the devices locale settings. It's in the documentation.

    You have to first create the min and max dates you want to use then adjust for the local timezone of your device and then use their respective long's, (getTimeInMillis()), and assign it to min/max date properties of the DatePicker.

提交回复
热议问题