Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;

public class Main {
    private static DateFormat dayMonthDateFormat;

    public static String getDayMonthDateToUser(Date date) {
        if (date != null) {
            return getDayMonthDateFormat().format(date);
        } else {
            return "";
        }
    }

    private static DateFormat getDayMonthDateFormat() {
        if (dayMonthDateFormat == null) {
            dayMonthDateFormat = new SimpleDateFormat("dd/MM", new Locale("pt", "BR"));
        }
        return dayMonthDateFormat;
    }
}