Generates a custom date in format d/MM/uuuu - Java java.time

Java examples for java.time:Format

Description

Generates a custom date in format d/MM/uuuu

Demo Code


//package com.java2s;

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

public class Main {
    /**/*w  ww  .j  av a 2s.c  o  m*/
     * Generates a custom date.
     * @param day The day of the date
     * @param month The month of the date
     * @param year The year of the date
     * @return
     */
    public static String getCustomDate(int day, int month, int year) {
        return LocalDate.of(year, month, day).format(
                DateTimeFormatter.ofPattern("d/MM/uuuu"));
    }
}

Related Tutorials