- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get the number of hours in this duration
At first, set the Duration −
Duration duration = Duration.ofDays(25);
Now, get the number of hours from the above Duration that has 25 days −
duration.toHours()
Example
import java.time.Duration; public class Demo { public static void main(String[] args) { Duration duration = Duration.ofDays(25); System.out.println("Hours in 25 days = "+duration.toHours()); } }
Output
Hours in 25 days = 600
- Related Articles
- Java Program to get the number of minutes in this duration
- Java Program to convert this duration to the total length in nanoseconds
- Java Program to convert this duration to the total length in milliseconds
- Java Program to get duration between two time instants
- Duration get() method in Java
- How to get the duration between two Instant timestamps in Java
- Java Program to create Duration from seconds
- Change leaves duration from hours to days in SAP Fiori app
- Get the ID of this timezone in Java
- Duration of() method in Java
- Get the free space of this partition in Java
- Get the usable space of this partition in Java
- Get the total space of this partition in Java
- How to get the number of siblings of this node in a JTree?
- Java Program to get number of elements with odd factors in given range

Advertisements