java 利用Calendar进行日期更改


//建立1个日期实例

Date tomorrow= new Date();

//获取今天日期

Date nowDate = Calendar.getInstance().getTime();

// 构建Calendar实例
Calendar calendars = Calendar.getInstance();

calendars.setTime(nowDate);

//日历加一

calendars.add(Calendar.DAY_OF_MONTH,+1);

tomorrow= new Date(calendars.getTimeInMillis());

//转换类型日历转字符串

String dateStr = new SimpleDateFormat("yyyyMMdd").format(tomorrow);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM