Java Convert Number of Days to Minutes

Tags: Java Duration Java 8

In this Java core tutorial we learn how to convert number of days to number of minutes in Java programming language.

How to convert number of days to minutes in Java

In Java, with a number of days we can use the java.time.Duration class to convert it to number of minutes as the following Java code.

ConvertDaysToMinutesExample1.java

import java.time.Duration;

public class ConvertDaysToMinutesExample1 {
    public static void main(String... args) {
        long numberOfDays = 30;

        // Convert number of days to minutes
        Duration duration = Duration.ofDays(numberOfDays);
        long numberOfMinutes = duration.toMinutes();

        System.out.println("Number of days: " + numberOfDays);
        System.out.println("Number of minutes: " + numberOfMinutes);
    }
}
The output as below.
Number of days: 30
Number of minutes: 43200

Happy Coding 😊

Java Convert Number of Days to Hours

Java Convert Number of Days to Seconds

Java Convert Number of Days to Milliseconds