TimeUnit toMillis() method in Java with Examples
The toMillis() method of TimeUnit Class is used to get the time represented by the TimeUnit object, as the number of Seconds, since midnight UTC on the 1st January 1970. Syntax:
public long toMillis(long duration)
Parameters: This method accepts a mandatory parameter duration which is the duration in milliSeconds. Return Value: This method returns the converted duration as Seconds. Below program to illustrate the implementation of TimeUnit toMillis() method: Program 1:
Time 1539585757 Seconds in MilliSeconds = 1539585757000
Time 1539585759 Seconds in MilliSeconds = 1539585759000
My Personal Notes arrow_drop_up
Please Login to comment...