Mahdi Giveie
Mahdi Giveie

Reputation: 640

How to Get Next 3 month Date Android

i use this code to get today's date and display it

m_today = Calendar.getInstance();

now how can i get the next 3 month date? something like this:

NOV 21.2012 to FEB 21,2013

i can display the first part but how to display second part?

Upvotes: 1

Views: 2628

Answers (2)

dorjeduck
dorjeduck

Reputation: 7794

m_today.add(Calendar.MONTH, 3);

Upvotes: 4

Shashank Kadne
Shashank Kadne

Reputation: 8101

This should work,

Calendar cal = Calendar.getInstance(); //Get the Calendar instance
cal.add(Calendar.MONTH,3);//Three months from now
cal.getTime();// Get the Date object

Upvotes: 7

Related Questions