Home Java LocalDateTime Methods getMinute() Java LocalDateTime getMinute() Method Definition In Java, getMinute() returns the minute part of a LocalDateTime, from 0 to 59.
It reads only the minute inside the current hour. For example, 14:45 gives 45, and the hour does not count.
An instance method of java.time.LocalDateTime (since Java 8): call it on a LocalDateTime object. Add import java.time.LocalDateTime; at the top of your file.
Syntax Call it on a LocalDateTime. It takes no arguments.
LocalDateTime dt = LocalDateTime.of(2026, 3, 15, 14, 45);
int minute = dt.getMinute(); // 45 Call What it does dt.getMinute()Returns the minute from 0 to 59, for example 45. dt.getHour()Returns the hour of the day, 0 to 23. dt.getSecond()Returns the second of the minute, 0 to 59. dt.get(ChronoField.MINUTE_OF_DAY)Returns the minutes since midnight, 0 to 1439.
For the total minutes since midnight, use get(ChronoField.MINUTE_OF_DAY) or calculate it from the hour and the minute.
Library declarations // java.time.LocalDateTime
public int getMinute() Parameters Parameter Description None getMinute() takes no parameters.
Return Value Return Value Description intThe minute of the hour, from 0 to 59.
Important
getMinute() is only the minute inside the hour . A time that is 90 minutes after midnight gives 30, not 90. To get the minutes since midnight, combine it with getHour(), as in Example 2.
Compare with Similar Methods Other ways to read part of a date-time:
Java Examples 1. Read the minute 2. Minutes since midnight 3. Quarter hour Example 1 — Read the Minute of the Hour Read the minute of three different times.
import java.time.LocalDateTime;
public class LdtGetMinuteDemo {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2026, 3, 15, 14, 45);
LocalDateTime b = LocalDateTime.of(2026, 3, 15, 9, 0);
LocalDateTime c = LocalDateTime.of(2026, 3, 15, 23, 59);
System.out.println("14:45 -> " + a.getMinute());
System.out.println("09:00 -> " + b.getMinute());
System.out.println("23:59 -> " + c.getMinute());
}
} 14:45 -> 45
09:00 -> 0
23:59 -> 59 How It Works Three times. They have different hours and minutes.Only the minute is returned. The hour does not change the answer, so 14:45 gives 45.The range is 0 to 59. A time on the hour gives 0, and 23:59 gives 59.Example 2 — Count Minutes Since Midnight Combine the hour and the minute to get the minutes since midnight.
import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
public class LdtGetMinuteMidnight {
public static void main(String[] args) {
LocalDateTime dt = LocalDateTime.of(2026, 3, 15, 10, 30);
int fromParts = dt.getHour() * 60 + dt.getMinute();
int fromField = dt.get(ChronoField.MINUTE_OF_DAY);
System.out.println("from hour and minute: " + fromParts);
System.out.println("from MINUTE_OF_DAY: " + fromField);
}
} from hour and minute: 630
from MINUTE_OF_DAY: 630 How It Works 10:30. The time has 10 hours and 30 minutes.Do the math by hand. 10 hours times 60 is 600, and adding the 30 minutes gives 630.Ask for the field. ChronoField.MINUTE_OF_DAY gives the same 630 in one call.Example 3 — Round Down to a Quarter Hour Use integer division to find the start of the quarter hour for two times.
import java.time.LocalDateTime;
public class LdtGetMinuteQuarter {
public static void main(String[] args) {
LocalDateTime[] times = {
LocalDateTime.of(2026, 3, 15, 10, 47),
LocalDateTime.of(2026, 3, 15, 10, 14)
};
for (LocalDateTime t : times) {
int roundedDown = (t.getMinute() / 15) * 15;
System.out.println(t.getMinute() + " -> " + roundedDown);
}
}
} How It Works Two times. 10:47 and 10:14.Divide by 15. Integer division drops the remainder, so 47 / 15 is 3 and 14 / 15 is 0.Multiply by 15 again. That gives 45 for the first time and 0 for the second, the start of each quarter hour.Frequently Asked Questions How do I get the minute from a LocalDateTime in Java? Call dt.getMinute(). It returns a number from 0 to 59.
Does getMinute() change the LocalDateTime? No. It only reads a value. LocalDateTime is immutable, so no method can change it.
How do I get the current minute in Java? Use LocalDateTime.now().getMinute().
How do I get the total minutes since midnight in Java? Use dt.get(ChronoField.MINUTE_OF_DAY), or dt.getHour() * 60 + dt.getMinute().
Why does getMinute() never return 60 or more? It is the minute inside the hour, so the largest value is 59. After 59, the hour goes up and the minute starts again at 0.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
10 people found this page helpful
Helpful Share Copy link Suggestion