How can one day be added to a date?

0 votes

I want to add one day to a particular date. How can I do that?any help?

Jun 8, 2018 in Java by Akrati
• 3,150 points
22 views

1 answer to this question.

0 votes

One possible solution could be using calendar class:

Date dt = new Date();
Calendar cal = Calendar.getInstance(); 
cal.setTime(dt); 
cal.add(Calendar.DATE, 1);
dt = cal.getTime();
answered Jun 8, 2018 by Daisy
• 8,050 points

Related Questions In Java

0 votes
1 answer

Can quotes be added in a java string.how?

In Java, you can escape quotes with \: String ...READ MORE

answered Jun 14, 2018 in Java by Akrati
• 960 points
25 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20 in Java by Sirajul
• 25,700 points
134 views
0 votes
1 answer

How can a war file be deployed in Tomcat 7?

You can access your application from: http://localhost:8080/sample Deploying ...READ MORE

answered Apr 20, 2018 in Java by sophia
• 1,400 points
522 views
0 votes
2 answers

How a static map can be initialized?

public class Test { ...READ MORE

answered Sep 12, 2018 in Java by Sushmita
• 6,880 points
72 views
0 votes
4 answers

How can we compare dates in java?

public static String daysBetween(String day1, String day2) ...READ MORE

answered Sep 5, 2018 in Java by Sushmita
• 6,880 points
40 views
0 votes
1 answer

How can I calculate number of days between two dates?

You may refer this. This might work ...READ MORE

answered Jul 19, 2018 in Java by Akrati
• 3,150 points
219 views
0 votes
1 answer

How to calculate the interval between 2 dates

The following code might be helpful: public static ...READ MORE

answered Aug 29, 2018 in Java by bug_seeker
• 15,350 points
34 views
0 votes
1 answer

Get the Current time in Python

To get the current date and time ...READ MORE

answered Oct 3, 2018 in Python by SDeb
• 13,160 points
51 views
0 votes
2 answers

How can we add an image to a JPanel?

If you are using JPanels, then are ...READ MORE

answered Sep 20, 2018 in Java by Daisy
• 8,050 points
73 views
0 votes
1 answer

How to determine day of week by passing specific date?

You can use java.util.Calendar: Calendar c = Calendar.getInstance(); c.setTime(yourDate); int dayOfWeek ...READ MORE

answered Oct 30, 2018 in Java by Daisy
• 8,050 points
75 views