Java 8 – HijrahDate, How to calculate the Ramadan date
Ramadan is the 9th month of the Islamic calendar, the entire month.
Java 8 – TemporalAdjusters examples
In Java 8, you can use the predefined java.time.temporal.TemporalAdjusters to adjust a date or Temporal. Example to move a date to firstDayOfMonth, firstDayOfNextMonth, next Monday and etc. Example to implement…
Java – How to add days to current date
This article shows you how to add days to the current date, using the classic java.util.Calendar and the new Java 8 date and time APIs.
Java Date and Calendar examples
This tutorial shows you how to work with java.util.Date and java.util.Calendar. Java Date Examples: Convert Date to String, Convert String to Date, Get current date time, Convert Calendar to Date.…
Java – Check if the date is older than 30 days or 6 months
This article shows Java 8 and legacy date-time APIs example to check if a date is 30 days or 6 months older than the current date. We can use few…
Java 8 – Difference between two LocalDate or LocalDateTime
In Java 8, we can use Period, Duration or ChronoUnit to calculate the difference between two LocalDate or LocaldateTime: 1 - Period to calculate the difference between two LocalDate, 2…
How to compare dates in Java
This article shows few examples to compare two dates in Java. Updated with Java 8 examples. For the legacy java.util.Date, we can use compareTo, before(), after() and equals() to compare…
Java 8 – ZonedDateTime examples
Few Java 8 java.time.ZonedDateTime examples to show you how to convert a time zone between different countries. The LocalDateTime has no time zone; to convert the LocalDateTime to ZonedDateTime, we…
Java – Convert date and time between timezone
In this tutorial, we will show you few examples (ZonedDateTime (Java 8), Date, Calendar and Joda Time) to convert a date and time between different time zones. For time zone,…
Java 8 – Convert Date to LocalDate and LocalDateTime
Few examples to convert classic Date to Java Time dates and vice versa: Convert java.util.Date to java.time.LocalDate, Convert java.util.Date to java.time.LocalDateTime, Convert java.util.Date to java.time.ZonedDateTime. The java.util.Date has no concept…