How to add ten days to current date using java? Is net beans or ecllipse which is suitable for a project?

I didn't  know how to add ten days to current date and to give the date after ten days

Replies

  • Kaustubh Katdare
    Kaustubh Katdare

    I think Java has a Calendar class which you can use to add dates to any date. Here's the official documentation: Calendar (Java 2 Platform SE 5.0)

    Date dt = new Date(); Calendar c = Calendar.getInstance(); c.setTime(dt); c.add(Calendar.DATE, 1); dt = c.getTime();

    in Java 8, you may do something like -

    LocalDateTime.from(dt.toInstant()).plusDays(1);

    Replace "1" with the number of days you wish to add. I'm not a Java expert. I think #-Link-Snipped-# might help. He knows Java stuff. 

You are reading an archived discussion.

Related Posts

We are working on an important feature called 'CrazyEngineers Messaging'; and stuck at an important decision. Should it be open to every member of the site OR only to those...
At what distance a cover should or must be placed in beam as well as in column 
Hi, Greeting from Loom Solar!I am Nishi Chandra from Loom Solar, is India's premium solar brand store headquartered in Delhi NCR. It sells solar systems such as solar panels, solar...
Machine Design says: Most people would agree that driverless cars are the future. With the recent leaps and bounds made in the self-driving car industry, very few people would be...
On popular demand, we have launched free online aptitude tests on CrazyEngineers.You can take these tests from any device (desktop or mobile) on any browser. You will get correct answers...