1.将字符串String转为Calendar
String dateString = "2018-09-11";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(dateString);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
2.日期加减
# 月份加1
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);
3.Calendar转Date
Date date = cal.getTime();
4.Date转String
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String strDate = sdf.format(date);
参考文章:
最新评论
本来在正常下载,突然就不能下载,并出现报错:a socket operation was attempted to an unreachable network。请问是什么原因呢
试了,还是不行,能不能更新一下
试了,确实不行,能不能更新一下
也推荐一下我自己写的 https://twitdown.com