Java Timestamp setTime() Method

The setTime() method of Timestamp class sets this class's object to indicate a point in time(milliseconds) after January 1, 1970 00:00:00 GMT.

Syntax

Parameters

Here the parameter 'time' represents the number of milliseconds.

Overrides

The setTime() method of Timestamp class overrides:

setTime() method in class Date

Example 1

Output:

Timestamp : 2018-09-01 09:01:15.0
Milliseconds : 1970-01-01 06:46:07.577

Example 2

Output:

Timestamp : 2018-09-01 09:01:15.0
New Timestamp : 1969-10-10 18:45:43.211