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.
Favourite tutorials for developers
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.
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…
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…
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…
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…
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…
Java 8 examples to show you how to convert from Instant to ZonedDateTime. Example to convert a Instant UTC+0 to a Japan ZonedDateTime UTC+9. Convert the Japan ZonedDateTime UTC+9 back…
Java 8 examples to show you how to convert from Instant to LocalDateTime and vice versa. The java.time.LocalDateTime has no concept of time zone, just provide a zero offset UTC+0.
Few examples to show you how to use Java 8 Duration, Period and ChronoUnit objects to find out the difference between dates. Duration – Measures time in seconds and nanoseconds.…
This article shows few Java examples to get the current date time or timestamp in Java. (Updated with Java 8): 1 - uses java.sql.Timestamp to get the current timestamp and…