LocalTime ofSecondOfDay() method in Java with Examples
The ofSecondOfDay() method of LocalTime class is used to obtain LocalTime Instance from a second-of-day value. This returns a LocalTime with the specified the second-of-day, from 0 to 24 * 60 * 60 – 1 passed as parameter.
public static LocalTime ofSecondOfDay(long secondOfDay)
Parameters: This method accepts a single parameter secondOfDay which is the second-of-day, from 0 to 24 * 60 * 60 – 1.
Return value: This method returns LocalTime instance created from the specified secondOfDay.
Exception: This method throws DateTimeException if the second-of-day value is invalid.
Below programs illustrate the ofSecondOfDay() method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.