I know two ways and capture a
TimeInMillis() anyone know the difference and which is the most efficient? What if there is a third way to capture this value?
I noticed that there is a class called
TimeStamp and I can't pass a
System.currentTimeMillis() to it.
long time = System.currentTimeMillis(); Timestamp timestamp = new Timestamp(time);
The constructor Timestamp(long) is undefined
You must be importing the wrong
Timestamp as this constructor has always existed. Check the
import , the correct one is
About getting the time in milliseconds,
System.currentTimeMillis() is faster because it's a native function and doesn't need the creation of objects. If I create a
new java.util.Date() the constructor internally calls the
currentTimeMillis() method, as does the
Calendar instance (I just checked the