LocalTime toString() method in Java with Examples Last Updated : 06 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The toString() method of LocalTime class is used to represents this time as a String, such as 20:15:34.111. Following ISO-8601 formats are used for representation: HH:mm HH:mm:ss HH:mm:ss.SSS HH:mm:ss.SSSSSS HH:mm:ss.SSSSSSSSS This method is derived from the Object Class and behaves in a similar way. Syntax: public String toString() Parameters: This method accepts no parameter. Return value: This method returns a String representation of this LocalTime. Below programs illustrate the toString() method: Program 1: Java // Java program to demonstrate // LocalTime.toString() method import java.time.*; public class GFG { public static void main(String[] args) { // create a LocalTime object LocalTime time = LocalTime.parse("19:34:50.63"); // print LocalTime System.out.println("LocalTime : " + time.toString()); } } Output: LocalTime : 19:34:50.630 Program 2: Java // Java program to demonstrate // LocalTime.toString() method import java.time.*; public class GFG { public static void main(String[] args) { // create a LocalTime object LocalTime time = LocalTime.parse("01:00:01"); // print LocalTime System.out.println("Old LocalTime: " + time.toString()); // add 600 Minutes using plusMinutes() LocalTime value = time.plusMinutes(600); // print result System.out.println("New LocalTime: " + value.toString()); } } Output: Old LocalTime: 01:00:01 New LocalTime: 11:00:01 References: https://docs.oracle.com/javase/10/docs/api/java/time/LocalTime.html#toString() Comment More infoAdvertise with us Next Article LocalTime toString() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-time package Java-LocalTime Practice Tags : Java Similar Reads Locale toString() Method in Java with Examples The toString() method of Locale class in Java is used to return a string representation of this locale. Each element i.e., the language, country or the variant of the locale is separated by underbars Syntax: LOCALE.toString() Parameters: This method does not take any parameters. Return Value: This m 1 min read LocalDate toString() method in Java with Examples The toString() method of a LocalDate class is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd. Syntax: public String toString() Parameters: This method does not accepts any parameters. Return value: This method returns String which is the re 1 min read LocalDateTime toString() method in Java with Examples The toString() method of LocalDateTime class is used to get the String representation of this LocalDateTime. This method is derived from the Object Class and behaves in the similar way. Syntax: public String toString() Parameter: This method takes no parameters. Returns: This method returns a String 1 min read Level toString() method in Java with Examples The toString() method of java.util.logging.Level is used to get the string value which represents this Level.This method returns a string representation of this Level. Syntax: public String toString() Parameters: This method accepts nothing. Return: This method returns a string representation of thi 1 min read Matcher toString() method in Java with Examples The toString() method of Matcher Class is used to get the String representation of this matcher. This method is derived from the Object Class and behaves in the similar way. Syntax: public String toString() Parameters: This method takes no parameters. Return Value: This method returns a String value 2 min read Like