System.currentTimeMillis() vs. new Date() vs. Calendar.getInstance().getTime()

In Java, what are the performance and resource implications of using

System.currentTimeMillis() 

vs.

new Date() 

vs.

Calendar.getInstance().getTime()

As I understand it, System.currentTimeMillis() is the most efficient. However, in most applications, that long value would need to be converted to a Date or some similar object to do anything meaningful to humans.

8 Answers
8

Leave a Comment