import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
public class MainClass{
public static void main(String[] argv){
int[] styles = { DateFormat.SHORT, DateFormat.MEDIUM,
DateFormat.LONG, DateFormat.FULL };
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
for (int style:styles) {
DateFormat df = DateFormat.getDateInstance(style);
System.out.println(df.format(date));
}
}
}
|