Format LocalDate to String in Java

Learn to format a LocalDate instance to String using inbuilt patterns as well as custom patterns.

1. Inbuilt Patterns

1.1. Default Pattern -> yyyy-MM-dd

If we use the LocalDate.toString() method then it formats the date in default format which is yyyy-MM-dd.

LocalDate today =;


Program output.


1.2. FormatStyle

FormatStyle is an immutable and thread-safe enumeration of the style of ‘localized’ date formatters. Based on the Locale, each constant may output a different string.

It has 4 constants:

  • FULL – Thursday, 17 February, 2022
  • LONG – 17 February 2022
  • MEDIUM – 17/02/22
  • SHORT – 4/3/19
LocalDate today =;

String formattedDate = today.format(DateTimeFormatter
System.out.println("LONG format: " + formattedDate);

formattedDate = today.format(DateTimeFormatter
System.out.println("MEDIUM format: " + formattedDate);

formattedDate = today.format(DateTimeFormatter
System.out.println("SHORT format: " + formattedDate);

formattedDate = today.format(DateTimeFormatter
System.out.println("FULL format: " + formattedDate);

Program output.

LONG format: 17 February 2022
MEDIUM format: 17-Feb-2022
SHORT format: 17/02/22
FULL format: Thursday, 17 February, 2022

2. Custom Patterns

If we have a date pattern that is not available inbuilt, we can define our own pattern and use it. To format the localdate in any other custom pattern, we must use LocalDate.format(DateTimeFormatter) method.

LocalDate today =;

String formattedDate = today.format(DateTimeFormatter.ofPattern("dd-MMM-yy"));


Program output.


Happy Learning !!

Sourcecode Download

Was this post helpful?

Join 7000+ Awesome Developers

Get the latest updates from industry, awesome resources, blog updates and much more.

* We do not spam !!

2 thoughts on “Format LocalDate to String in Java”

Leave a Comment


A blog about Java and related technologies, the best practices, algorithms, and interview questions.