Here you can find the source of dateToString(LocalDate date)
public static String dateToString(LocalDate date)
//package com.java2s; //License from project: Open Source License import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Locale; public class Main { private static final String SHORT_PATTERN_EN = "yyyy-MM-dd"; private static final String SHORT_PATTERN_FR = "dd/MM/yyyy"; /**/* w ww . j ava2s. c o m*/ * @param date The date to format * @return A date given following {@link #SHORT_PATTERN_EN} pattern */ public static String dateToString(LocalDate date, Locale locale) { return getShortFormatter(locale).format(date); } public static String dateToString(LocalDate date) { return dateToString(date, null); } private static DateTimeFormatter getShortFormatter(Locale locale) { String pattern = SHORT_PATTERN_EN; if (Locale.FRANCE.equals(locale)) pattern = SHORT_PATTERN_FR; return DateTimeFormatter.ofPattern(pattern); } }