Format date in Short format in Java
Description
The following code shows how to format date in Short format.
Example
// w ww . j a v a 2s . c o m
import java.text.DateFormat;
import java.util.Date;
public class Main {
public static void main(String[] args) {
Date date = new Date();
String strDate = DateFormat.getDateInstance(DateFormat.SHORT).format(date);
System.out.println(strDate);
}
}
The code above generates the following result.