LocalTime getMinute() method in Java with Examples
The getMinute() method of a LocalTime class is used to return the minute-of-hour field. This method returns an integer value ranging from 0 to 59, i.e. the Minutes of a hour.
Syntax:
public int getMinute()
Parameters: This method does not accept any parameter.
Return value: This method returns an integer value which represents minute-of-hour and it ranges from 0 to 59.
Below programs illustrate the getMinute() method:
Program 1:
// Java program to demonstrate // LocalTime.getMinute() 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" ); // get Minute field using getMinute() int Minute = time.getMinute(); // print result System.out.println( "Minute Field: " + Minute); } } |
Minute Field: 34
Program 2:
// Java program to demonstrate // LocalTime.getMinute() method import java.time.*; public class GFG { public static void main(String[] args) { // create a LocalTime object LocalTime time = LocalTime.parse( "23:14:30.53" ); // get Minute field using getMinute() int Minute = time.getMinute(); // print result System.out.println( "Minute Field: " + Minute); } } |
Minute Field: 14
Reference:
https://docs.oracle.com/javase/10/docs/api/java/time/LocalTime.html#getMinute()
Recommended Posts:
- LocalDateTime getMinute() method in Java with Examples
- OffsetTime getMinute() method in Java with examples
- ZonedDateTime getMinute() method in Java with Examples
- OffsetDateTime getMinute() method in Java with examples
- LocalTime until() Method in Java with Examples
- LocalTime from() method in Java with Examples
- LocalTime get() method in Java with Examples
- LocalTime plus() method in Java with Examples
- LocalTime with() Method in Java with Examples
- LocalTime getSecond() method in Java with Examples
- LocalTime getHour() method in Java with Examples
- LocalTime plusNanos() method in Java with Examples
- LocalTime getLong() method in Java with Examples
- LocalTime isSupported() method in Java with Examples
- LocalTime plusHours() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.