Convert Milliseconds into Years, Months, Weeks, Days, Hours, Minutes, Seconds in Java

Introduction This example shows you how to convert milliseconds into years, months, weeks, days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into years or months or weeks or days or hours or minutes or seconds. For example, when you want to check the exact time taken by a program to execute then you may need to calculate the time. So in this case you get the start time in milliseconds and end time in milliseconds and you want to check how much time that program…

Continue

What is the use of @Temporal annotation in JPA

Here you will know what is the use of @Temporal annotation in JPA. @Temporal is a JPA annotation and generally specified only for persistent fields or properties of type java.util.Date and java.util.Calendar. Generally you use @Temporal annotation on the date or calendar field in entity classes during table and Java class mapping where Hibernate is used as an ORM (Object Relational Mapping) framework. You won’t be able to apply @Temporal annotation on Java 8 date time API. If you try to use @Temporal annotation on Java 8 date time API then…

Continue

Convert Milliseconds into Days, Hours, Minutes, Seconds in Java

Introduction This example shows you hot to convert milliseconds into days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into days or hours or minutes or seconds. Typically when you want to check the exact time taken to execute a program then you may need to calculate the time. So in this case you get the start time in milliseconds and end time in milliseconds and you want to check how much time that program took to execute. Therefore you would like to convert the milliseconds…

Continue