Format date with dd-MMM-yy in Java
Description
The following code shows how to format date with dd-MMM-yy.
Example
// w w w . j a va2 s .c om
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] argv) throws Exception {
Format formatter = new SimpleDateFormat("dd-MMM-yy");
String s = formatter.format(new Date());
System.out.println(s);
}
}
The code above generates the following result.