将java.util.Date增加一天 [英] Incrementing a java.util.Date by one day
本文介绍了将java.util.Date增加一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在考虑像
日历cal = Calendar.getInstance();
cal.setTime(toDate);
cal.add(Calendar.DATE,1);
toDate = cal.getTime();
它不感觉正确。
解决方案
这将会起作用。
p>
如果是烦恼的烦恼,欢迎使用Java日期时间API: - )
What is the correct way to increment a java.util.Date by one day.
I'm thinking something like
Calendar cal = Calendar.getInstance();
cal.setTime(toDate);
cal.add(Calendar.DATE, 1);
toDate = cal.getTime();
It doesn't 'feel' right.
解决方案
That would work.
It doesn't 'feel' right.
If it is the verbosity that bothers you, welcome to the Java date-time API :-)
这篇关于将java.util.Date增加一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文