简体   繁体   English

如何获得未来3个月的日期Android

[英]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? 现在如何获得下一个3个月的日期? something like this: 像这样的东西:

NOV 21.2012 to FEB 21,2013 2012年11月21日至2013年2月21日

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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