format LocalDate as MM/dd/yyyy - Java java.time

Java examples for java.time:Format

Description

format LocalDate as MM/dd/yyyy

Demo Code


//package com.java2s;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Main {
    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter
            .ofPattern("MM/dd/yyyy");

    public static String format(LocalDate date) {
        return DATE_FORMATTER.format(date);
    }//from  ww  w.j av  a2  s  .  c o  m
}

Related Tutorials