package com.javapages4all;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
* @author Rajeswararao (JavaPages4All)
*
*/
public class DateFormatConversion {
public static void main(String[] args) {
Format format;
Date date = new Date();
System.out.println(date); // Sat May 10 00:31:18 IST 2014
format = new SimpleDateFormat("dd/MM/yy");
System.out.println(format.format(date)); // 10/05/14
format = new SimpleDateFormat("MM/dd/yy");
System.out.println(format.format(date)); // 05/10/14
format = new SimpleDateFormat("dd-MMM-yy");
System.out.println(format.format(date)); // 10-May-14
format = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
System.out.println(format.format(date)); // 2014.05.10.00.27.08
format = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
System.out.println(format.format(date)); // Sat, 10 May 2014 00:27:08 +0530
format = new SimpleDateFormat("EEEE, dd MMMM yyyy HH:mm:ss zzzz");
System.out.println(format.format(date)); //Saturday, 10 May 2014 00:27:08 India Standard Time
}
}