如何将DateTime转换为Date [英] How to convert DateTime to Date
本文介绍了如何将DateTime转换为Date的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将日期
转换为 DateTime
,反之亦然?
How can I convert Date
to DateTime
and vice versa?
例如
Date dt = new Date();
现在我想将其转换为 DateTime
。
Now I want to covert this to DateTime
.
此外
DateTime dtim = new DateTime();
现在我想将其转换为日期。
Now I want to convert it to Date.
推荐答案
这是 Joda时间
的 DateTime
你在说话关于?如果是这样,它将是
Is this Joda Time
's DateTime
you're talking about? If so, it will be
dateTime.toDate()
这篇关于如何将DateTime转换为Date的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文