How to retrieve milliseconds from java.sql.Timestamp

java

Solution

You can use Timestamp.getTime()

Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Timestamp object.

Example:

long timeInMilliSeconds = t.getTime();
// do magic trick here

Note: Timestamp is extend from Date.

Problem

I have a timestamp object and need to get the milliseconds from it, can someone help me with an example code snippet ?

Original source