java日期

public class DateUtil{ SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); Date date = new Date(); System.out.println(sdf.format(date)+"========"+date.getTime()); //这种增加好像只能增加到一个月之内~~~ Date date2 = new Date(date.getTime()+1000*60*60*24*20); System.out.println(sdf.format(date2)+"========="+date2.getTime()); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 100); Date date3 = calendar.getTime(); System.out.println(sdf.format(date3)); }

java日期
文章图片
111.png

    推荐阅读