更新时间:2023-02-19 14:21:22
这是不可能的。 TimeOfDay
仅保留小时和分钟。尽管 DateTime
还具有日/月/年
This is not possible.
TimeOfDay
holds only the hour and minute. While a DateTime
also has day/month/year
如果要进行转换,则需要更多信息。如当前的DateTime。然后将两者合并为一个最终日期时间。
If you want to convert it, you will need more informations. Such as the current DateTime. And then merge the two into one final datetime.
TimeOfDay t;
final now = new DateTime.now();
return new DateTime(now.year, now.month, now.day, t.hour, t.minute);