OffsetTime toLocalTime() method in Java with examples Last Updated : 31 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The toLocalTime() method of OffsetTime class in Java gets the LocalTime part of this date-time. Syntax : public LocalTime toLocalTime() Parameter: This method does not accepts any parameter. Return Value: It returns a LocalTime with the same hour, minute, second and nanosecond as this date-time. Below program illustrate the toLocalTime() method: Java // Java program to demonstrate the toLocalTime() method import java.time.OffsetTime; public class GFG { public static void main(String[] args) { // Gets the current time OffsetTime time = OffsetTime.now(); // Gets the local time System.out.println("Local-time: " + time.toLocalTime()); } } Output: Local-time: 03:59:10.258 Reference: https://docs.oracle.com/javase/8/docs/api/java/time/OffsetTime.html#toLocalTime-- Comment More infoAdvertise with us Next Article OffsetTime toLocalTime() method in Java with examples gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-OffsetTime Practice Tags : Java Similar Reads OffsetTime toString() method in Java with examples The toString() method of OffsetTime class in Java outputs this date as a String, such as "11:25:10+11:10" for an example. Syntax : public String toString() Parameter: This method does not accepts any parameter. Return Value: It returns a string representation of this date, not null. Below programs i 1 min read OffsetTime ofInstant() method in Java with examples The ofInstant() method of a OffsetTime class is used to obtain an instance of OffsetTime from an Instant and zone ID passed as parameters.In this method First, the offset from UTC/Greenwich is obtained using the zone ID and instant. Then, the local time has calculated from the instant and offset. Sy 1 min read OffsetDateTime of() method in Java with Examples The of(int year, int month, int day, int hour, int minute, int second, int nanosecond, ZoneOffset offset) method of the OffsetDateTime class in Java is used to create an instance of OffsetDateTime from the passed values of year, month, day, hour, minute, second, nanosecond and offset. In this method 3 min read OffsetTime query() method in Java with examples The Query() method of OffsetTime class in Java queries this time using the specified query. Syntax : public R query(TemporalQuery query) Parameter: This method accepts a single parameter query that specifies the query to be invoked and not null. Return Value: It returns the query result, null may be 1 min read OffsetTime of() method in Java with Examples The of(int hour, int minute, int second, int nanosecond, ZoneOffset offset) method of the OffsetTime class in Java is used to create an instance of OffsetTime from the passed values of hour, minute, second and nanosecond. In this method, we pass the value of hour, minute, second and nanosecond in in 2 min read OffsetDateTime get() method in Java with examples The get() method of OffsetDateTime class in Java gets the value of the specified field from this date as an int. Syntax : public int get(TemporalField field) Parameter : This method accepts a single parameter field which specifies the field to get, not null.Return Value: It returns the value for the 2 min read OffsetDateTime from() method in Java with examples The from() method of OffsetDateTime class in Java obtains an instance of OffsetDateTime from a temporal object.Syntax : public static OffsetDateTime from(TemporalAccessor temporal) Parameter : This method accepts a single parameter temporal which specifies the temporal object to convert, not null.Re 1 min read OffsetTime get() method in Java with examples The get() method of OffsetTime class in Java gets the value of the specified field from this time as an int. Syntax : public int get(TemporalField field) Parameter : This method accepts a parameter field which specifies the field to get, not null.Return Value: It returns the value for the field.Exce 2 min read OffsetTime now() method in Java with examples The now() method of OffsetTime class in Java obtains the current time from the system clock in the default time-zone. Syntax : public static OffsetTime now() Parameter: This method does not accepts any parameter. Return Value: It returns the current time using the system clock and default time-zone 2 min read OffsetTime from() method in Java with examples The from() method of OffsetTime class in Java obtains an instance of OffsetTime from a temporal object which is passed in the parameter of the method. Syntax: public static OffsetTime from(TemporalAccessor temporal) Parameter: This method accepts a single mandatory parameter temporal which specifies 1 min read Like