Chapter 13 Time & Date

Date

System.currentTimeMillis()

return LONG. It's the number of ms from 1970.1.1 0:0:0.

getDateInstance()
getTimeInstance()
getDateTimeInstance()

return detailed date & time.

20145109 《Java程序设计》第七周学习总结

SimpleDateFormat: self-defined format:

DateFormat dateFormat = new SimpleDateFormat("EE-MM-dd-yyyy");
System.out.println(dateFormat.format(new Date()));

Calendar

Calendar calendar = Calendar.gerInstance();
out.println(calendar.get(Calendar.YEAR));

calendar.set(2014, Calendar.MAY, 26); 

calendar.add(Calendar.HOUR, 3);

calendar.roll(Calendar.DATE, 1); // only handle the date, month won't modify

相关文章:

  • 2021-10-03
  • 2021-07-18
  • 2021-07-10
  • 2021-06-22
  • 2021-06-08
  • 2021-10-06
  • 2021-06-30
  • 2021-06-22
猜你喜欢
  • 2021-06-07
  • 2021-08-10
  • 2021-10-08
  • 2021-06-01
  • 2021-12-20
  • 2021-08-16
  • 2021-07-29
相关资源
相似解决方案