First and Last Day of Week, Month or Year in Java
Get the first and last day of week, month or year in Java with TemporalAdjusters, WeekFields for locales, YearMonth and quarter boundaries.
Get the first and last day of week, month or year in Java with TemporalAdjusters, WeekFields for locales, YearMonth and quarter boundaries.
Convert month number to name in Java with Month.getDisplayName(), and parse full or short month names back to numbers in any locale.
Convert an Instant to ZonedDateTime in Java with atZone() or ofInstant(), choose the right zone, convert back with toInstant() and avoid date shifts.
Convert LocalDate to ZonedDateTime in Java with atStartOfDay(zone) or atTime().atZone(), and back with toLocalDate(), including DST days and zone pitfalls.
Convert LocalDate to LocalDateTime in Java with atStartOfDay() and atTime(), and back with toLocalDate(), plus zone-aware day starts and day ranges.
Convert LocalDate to java.sql.Date and LocalTime to java.sql.Time, or skip both with JDBC 4.2 setObject() and getObject(), JPA and Hibernate.
Convert Date to LocalDate in Java with LocalDate.ofInstant() and back with Date.from(), pick the right time zone and avoid the one-day-off bug.
Convert LocalDateTime to Date in Java with atZone() and Date.from(), and back with ofInstant(), including DST gaps, overlaps and lost nanoseconds.
Convert LocalDateTime to ZonedDateTime in Java with atZone(), ofLocal() and ofStrict(), see how DST gaps and overlaps resolve, and convert back safely.
Convert date and time between time zones in Java with withZoneSameInstant(), from Instant, OffsetDateTime or LocalDateTime, with DST-safe examples.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.