Java 8 – How to parse date with "dd MMM" (02 Jan), without year?
This example shows you how to parse a date (02 Jan) without a year specified. JavaDateExample.java package com.mkyong.time; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Locale; public class JavaDateExample { public static void main(String[] args) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMM", Locale.US); String date = "02 Jan"; LocalDate localDate = LocalDate.parse(date, formatter); System.out.println(localDate); System.out.println(formatter.format(localDate)); } } Output …