简体   繁体   中英

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?

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
m_today.add(Calendar.MONTH, 3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM