VOOZH about

URL: https://www.geeksforgeeks.org/java/offsettime-oflocaltime-method-in-java-with-examples/

⇱ OffsetTime of(LocalTime) method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

OffsetTime of(LocalTime) method in Java with Examples

Last Updated : 5 Jun, 2020
The of(LocalTime time, ZoneOffset offset) method of the OffsetTime class in Java is used to create an instance of OffsetTime from the given instances of localtime and offset. Syntax:
public static OffsetTime of(LocalTime time,
 ZoneOffset offset)
Parameters: The method accepts two parameters.
  • time - It represents the local time. It should not be null.
  • offset - It represents the zone offset. It should not be null.
Return value: This method returns the OffsetTime. Exception: This method does not throw any exception. Below programs illustrate the of(LocalTime, ZoneOffset) method of OffsetTime class in Java: Program 1:
Output:
TIME: 03:14:11.212Z
Program 2:
Comment
Article Tags: