3 import java.text.DateFormat;
 4 
 5 import java.util.Date;
 6 import java.util.Locale;
 7 
 8 /**
 9  *
10  * @author aconover
11  */
12 public class TimeFormatting {
13 
14     public static void main(String[] args) {
15         DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
16         DateFormat df2 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
17         DateFormat df3 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.GERMANY);
18 
19         // defaults to current date/time.
20         Date d = new Date();
21 
22         System.out.println("The Long date is: " + df1.format(d));
23         System.out.println("The Short date is: " + df2.format(d));
24         System.out.println("The German Short date is: " + df3.format(d));
25     }
26 }