LocalTime getMinute() method in Java with Examples
Last Updated :
03 Dec, 2018
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:
import java.time.*;
public class GFG {
public static void main(String[] args)
{
LocalTime time
= LocalTime.parse( "19:34:50.63" );
int Minute = time.getMinute();
System.out.println( "Minute Field: "
+ Minute);
}
}
|
Program 2:
import java.time.*;
public class GFG {
public static void main(String[] args)
{
LocalTime time
= LocalTime.parse( "23:14:30.53" );
int Minute = time.getMinute();
System.out.println( "Minute Field: "
+ Minute);
}
}
|
Reference:
https://docs.oracle.com/javase/10/docs/api/java/time/LocalTime.html#getMinute()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...