Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8732783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:30:10+00:00 2026-06-13T09:30:10+00:00

Date date = new Date(); int lastMonth = date.getMonth(); int lastYear = 1900 +

  • 0
Date date = new Date();
int lastMonth = date.getMonth();
int lastYear = 1900 + date.getYear();

I have this code in my GWT project but a lot of method of java.util.Date is deprecated, 22/33 methods.
So I want to use Calendar/GregorianCalendar : it does not work. It said there is a missing package.

What is the best practice to replace these line of code with a not deprecated code ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:30:11+00:00Added an answer on June 13, 2026 at 9:30 am

    Don’t.

    java.util.Calendar is almost impossible to emulate, and has a way too high overhead. java.util.Date, while far from ideal, is the closest to JavaScript’s Date, so it’s the one you should use in GWT world.

    JSR 310 is promising (don’t know how well it could be emulated though, and with how much overhead compared to java.util.Date) but isn’t there yet.

    There’s also Joda Time (from the same author as JSR 310, JSR 310 aims at bringing Joda Time to the JDK along with fixing some of its early design mistakes), but most GWT ports have long been abandonned.

    In the end: use java.util.Date.

    And if you find the deprecation warnings annoying, then suppress them: @SuppressWarnings("deprecated").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code to get checked date,but it's not get the int[] value.
private String setDate(int day) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, + day);
I have data like the following: var data = [{ id: 1, date: new
all Decrease month by one in strtotime in this loop. $twitter_val7 .='{ date: new
I love the new DATE datatype in SQL Server 2008, but when I compare
I'm new to Java, Android, and SQLite, and I'm stuck at this. I have
I have the following code on the timeline, but when I try and output
I have a class and in that class I have this: //some code private
I have this code, it failed because thisMonthSundays are empty: public ActionResult TradeUKKPISearchesData() //show
I have this class: class Date { public: Date(); // Sets a date of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.