gwt的日期时间库
我正在开发一个gwt应用程序,它涉及到对日期时间的高级操作:从一个时区转换到另一个时区,等等。gwt在处理日期方面有一些低级的东西,但它们对我来说太低级了。对于gwt,是否有类似于joda time或Three Ten的选项?您可以查看以下选项gwt的日期时间库,gwt,jodatime,Gwt,Jodatime,我正在开发一个gwt应用程序,它涉及到对日期时间的高级操作:从一个时区转换到另一个时区,等等。gwt在处理日期方面有一些低级的东西,但它们对我来说太低级了。对于gwt,是否有类似于joda time或Three Ten的选项?您可以查看以下选项 这是我的DateTimeUtil类 public class DateTimeUtil { public static String getYear(Date date) { return DateTimeFormat.get
这是我的DateTimeUtil类
public class DateTimeUtil {
public static String getYear(Date date) {
return DateTimeFormat.getFormat("yyyy").format(date);
}
public static String getMonth(Date date) {
return DateTimeFormat.getFormat("MM").format(date);
}
public static String getDay(Date date) {
return DateTimeFormat.getFormat("dd").format(date);
}
public static String getHour(Date date) {
return DateTimeFormat.getFormat("HH").format(date);
}
public static String getMinute(Date date) {
return DateTimeFormat.getFormat("mm").format(date);
}
public static String getSecond(Date date) {
return DateTimeFormat.getFormat("ss").format(date);
}
// The String year must to have yyyy format
public static Date getDate(String years, String months, String days, String hours, String minutes, String seconds) {
DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");
Date date = dtf.parse(years + "-" + months + "-" + days + " " + hours + ":" + minutes + ":" + seconds);
GWT.log("date parsed " + date);
return date;
}
}
它们都是过时的,没有维护。是的。不幸的是,这些似乎是目前唯一的选择。我读到gwt时间在gwt问题列表上非常有用这个答案非常过时,对于日期操作,您可以使用gwt Calendarutil:1否决票您可以使用日历模拟和bitbucket()上open/gwt项目中的org.jresearch.commons.gwt.shared.tools.Dates实用程序类基于ftr gwt库项目()的仿真和实用程序类你在你的gwt应用程序中使用了joda time吗?@Justin事实上,我根据自己的具体需要编写了自己的库:-)