Java LocalDateTime getMinute() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Java 8+

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.

Java
LocalDateTime dt = LocalDateTime.of(2026, 3, 15, 14, 45);
int minute = dt.getMinute();   // 45
CallWhat 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
// java.time.LocalDateTime
public int getMinute()

Parameters

ParameterDescription
NonegetMinute() takes no parameters.

Return Value

Return ValueDescription
intThe minute of the hour, from 0 to 59.

Compare with Similar Methods

Other ways to read part of a date-time:

MethodHow it differs
getHour()Reads the hour.
getSecond()Reads the second.
withMinute(m)Sets the minute instead of reading it.

Java Examples

Example 1 — Read the Minute of the Hour

Read the minute of three different times.

Java
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());
    }
}

How It Works

  1. Three times. They have different hours and minutes.
  2. Only the minute is returned. The hour does not change the answer, so 14:45 gives 45.
  3. 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.

Java
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);
    }
}

How It Works

  1. 10:30. The time has 10 hours and 30 minutes.
  2. Do the math by hand. 10 hours times 60 is 600, and adding the 30 minutes gives 630.
  3. 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.

Java
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

  1. Two times. 10:47 and 10:14.
  2. Divide by 15. Integer division drops the remainder, so 47 / 15 is 3 and 14 / 15 is 0.
  3. 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

Call dt.getMinute(). It returns a number from 0 to 59.
No. It only reads a value. LocalDateTime is immutable, so no method can change it.
Use LocalDateTime.now().getMinute().
Use dt.get(ChronoField.MINUTE_OF_DAY), or dt.getHour() * 60 + dt.getMinute().
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.

Next: getMonth()

Read the month as a Month enum such as MARCH.

getMonth() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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