Javatpoint Logo
Javatpoint Logo

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

Test it Now

Output:

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

Example 2

Test it Now

Output:

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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA