2

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
  • If you can use Java 8, this reference has some examples. Commented Sep 22, 2015 at 15:38

3 Answers 3

6

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.

Sign up to request clarification or add additional context in comments.

Comments

-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/

1 Comment

The question stated that Calendar is not supported by GWT, which uses a subset of the Java language.
-2

I believe this will help answer your question.

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

2 Comments

Welcome to Stack Overflow! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
Unfortunately, Calendar is not available in the subset of JRE that GWT supports on the client side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.