Check If a Date Is Valid in Java (Strict Parsing Examples)
Check if a date is valid in Java with LocalDate and a strict DateTimeFormatter, then add rules such as not in the past. Covers leap years and regex limits.
Check if a date is valid in Java with LocalDate and a strict DateTimeFormatter, then add rules such as not in the past. Covers leap years and regex limits.
Learn to parse a date-time string to UTC in Java with Instant, OffsetDateTime and ZonedDateTime. Covers strings with Z, an offset, GMT or no zone at all. Also covers RFC 1123 dates, old SimpleDateFormat code and common DateTimeParseException causes.
ResolverStyle.STRICT rejects dates like February 30 that SMART and LENIENT adjust. See all three styles side by side, the uuuu vs yyyy trap and fixes.
Parse String to ZonedDateTime in Java with ISO text, VV and XXX patterns, ambiguous names like PST or IST, and strings that have no time zone.
Convert a string to LocalDateTime with LocalDateTime.parse() and DateTimeFormatter. Learn the ISO format, pattern letters, AM/PM and Locale, strings with a zone, date-only strings, strict parsing and common error messages.
Convert String to LocalDate in Java with LocalDate.parse(), custom patterns, month names in any locale and safe DateTimeParseException handling.
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.