Javatpoint Logo
Javatpoint Logo

Java Calendar setTimeInMillis() Method

The setTimeInMillis () method of java.util.Calendar class is used to set the current time in millisecond. The date value to be set is passed as long into this method.

Syntax

Parameter

millis - the new time in UTC milliseconds.

Returns

Does not return value.

Throws

Does not throw Exception.

Example 1

Test it Now

Output:

Current time (mycal) : Wed Aug 15 19:15:37 PDT 2018
Current time in Millis (mycal) : 1534385737060
Current time (mycal2) : Wed Aug 15 19:15:37 PDT 2018
Current time in Millis (mycal2) : 1534385737060

Example 2

Test it Now

Output:

Current time in Millis (mycal) : 1534386069658
Current time in Millis (mycal2) : 65310358869658




Please Share

facebook twitter google plus pinterest