1

Is there any easy way or a function to get what will be the date two weeks in advance? For example what will be the date after two weeks from now. I have checked Date() function and it doesn't look to have this functionality. The only way I can think of now is to hard code it, but I was hoping someone knows a better approach.

Laurynas G
  • 573
  • 9
  • 30
  • How about a `Calendar` object? You can pass to it your date via a `setTime` method and it has an `add` method, which will achieve what you want. https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#add%28int,%20int%29 – Ace_McIntosh Dec 25 '15 at 13:14

3 Answers3

1

Check Joda Time Lib. i found something may help you using this lib check this

Community
  • 1
  • 1
Sameer Donga
  • 988
  • 9
  • 24
1

I can't comment so I'll post this as an answer.

This question has already an answer here: How to add 7 days to current date while not going over available days of a month?

You need to use the Calendar class.

Community
  • 1
  • 1
Rares
  • 29
  • 10
1

Use this code :

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, +14);
Log.d("Date two weeks in advance is ",""+cal.getTime());
Monika
  • 135
  • 1
  • 12