View Feed
group-icon
Java Developers
Community of Java Developers: Get Java Programming Help from fellow Java Developers across the world.
597 Members
Join this group to post and comment.

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

Kaustubh Katdare
Kaustubh Katdare • Oct 4, 2018

I think Java has a Calendar class which you can use to add dates to any date. Here's the official documentation: Calendar Class in Java

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 @Kunal might help. He knows Java stuff. 

Share this content on your social channels -