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

Java examples for java.time:Format

Description

formatted LocalDate as dd/MM/yyyy

Demo Code


//package com.java2s;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

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

    public static String formattedDate(LocalDate date) {
        if (date == null)
            return "TBA";
        return DATE_FORMATTER.format(date);
    }/*from  w  w  w.ja  va 2s.  c o m*/
}

Related Tutorials