TimeUnit toDays() method in Java with Examples
The toDays() method of TimeUnit Class is used to get the time represented by the TimeUnit object, as the number of Days, since midnight UTC on the 1st January 1970. It is equivalent to DAYS.convert(duration, this). Syntax:
public long toDays(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 Days. Below program to illustrate the implementation of TimeUnit toDays() method: Program 1:
Time 1539585725051 milliSeconds in Days = 17819
Time 1539585730178 milliSeconds in Days = 17819
My Personal Notes arrow_drop_up
Please Login to comment...