the process of date operate in java is really messy. A simple issue is made really easy to confuse and hard to remember.
you may need three class to deal with date: date or System.currentTimeMillis(), SimpleDateFormat ,Calendar
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
Calendar canlandar = Calendar.getInstance();
canlandar.setTime(date); // oerate date via Calendar
canlandar.add(Calendar.DATE, i); //add or subtract day, month, year or whatever
System.out.println(df.format(canlandar.getTime()); //convert into string

1万+

被折叠的 条评论
为什么被折叠?



