get Pretty Date - Java java.util

Java examples for java.util:Date Format

Description

get Pretty Date

Demo Code


//package com.java2s;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        int year = 2;
        int month = 2;
        int day = 2;
        System.out.println(getPrettyDate(year, month, day));
    }/* w  w w .j  a  v a 2s .c o  m*/

    public static String getPrettyDate(int year, int month, int day) {
        Calendar c = new GregorianCalendar(year, month, day);
        DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG);
        return dateFormat.format(c.getTime());
    }
}

Related Tutorials