how to replace the deprecated constructor Date(int, int, int) in JAVA GWT?

蹲街弑〆低调 提交于 2020-01-25 02:21:06

问题


I'm working on an existing GWT app . I'm seeing this warning

the constructor Date(int, int, int) is deprecated

Since java.util.Calendar is not supported in GWT client side , I'm looking for how to replace this methode .


回答1:


There's no replacement for GWT (for now at least, java.time support/emulation should come some time in the future). Just put @SuppressWarnings("deprecation") if you want to get rid of the warning.




回答2:


Use always Calendar (GregorianCalendar would suit what you need). And when you need to turn it into a Date object, use Calendar.getTime()

This page has examples: http://www.mkyong.com/java/java-date-and-calendar-examples/




回答3:


I believe this will help answer your question.

You can use the Calendar.set() and Calendar.get() methods to set/get the date.



来源:https://stackoverflow.com/questions/32720987/how-to-replace-the-deprecated-constructor-dateint-int-int-in-java-gwt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!