3
Doubt:
I know two ways and capture one TimeInMillis()
does anyone know the difference and what is the most efficient? What if there is a third way to capture that value?
Option 1:
System.out.println(Calendar.getInstance().getTimeInMillis());
Option 2:
System.out.println(System.currentTimeMillis());
Problem:
I realized there’s a class called TimeStamp
and I can’t pass the one System.currentTimeMillis()
for her.
long time = System.currentTimeMillis();
Timestamp timestamp = new Timestamp(time);
Error:
The constructor Timestamp(long) is undefined
Problem is the
import java.security.Timestamp
that I was wrong in my code, I switched it and I was able to use theTimestamp
. The explanation ofTimeMillis
regarding the object helped a lot.– noNihongo