如何在 Java GWT 中进行日历操作?如何在日期中添加天数? [英] How to do calendar operations in Java GWT? How to add days to a Date?
本文介绍了如何在 Java GWT 中进行日历操作?如何在日期中添加天数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于GWT没有提供GregorianCalendar类,如何在客户端做日历操作?
Since GWT does not provide the GregorianCalendar class, how to do calendar operations on the client?
我有一个日期 a
并且我想要日期,它在 a
之后的 n
天.
I have a Date a
and I want the Date, which is n
days after a
.
示例:
a (2000-01-01) + n (1) -> 2000-01-02
a (2000-01-01) + n (31) -> 2000-02-01
推荐答案
更新了 GWT 2.1 的答案
Updated answer for GWT 2.1
final Date dueDate = new Date();
CalendarUtil.addDaysToDate(dueDate, 21);
此类的完全限定名称是 com.google.gwt.user.datepicker.client.CalendarUtil.
the fully qualified name of this class is com.google.gwt.user.datepicker.client.CalendarUtil.
这篇关于如何在 Java GWT 中进行日历操作?如何在日期中添加天数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文