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.
Asked
Active
Viewed 45 times
1
-
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 Answers
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.
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