简体   繁体   English

如何从UIDatePicker获取日期(模式设置为“仅时间”)

[英]How to get the date from an UIDatePicker with mode set to Time only

My UIDatePicker needs to show only the time, but I also need to get the current date when that time was set. 我的UIDatePicker只需要显示时间,但是我还需要获取设置该时间的当前日期。

Is this possible if the date picker has the mode set to Time ? 如果日期选择器的mode设置为“ Time ”,这可能吗?

Currently I get this when I print the current date from date picker: 目前,当我从日期选择器中打印当前日期时,会得到以下信息:

2000-01-01 3:00:00 AM +0000

您可以创建一个Date对象“ Date()”来获取当前日期,并且可以使用“ valueChanged”事件合并两个值,它们选择的时间和获得的日期

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM