Java Format - Java DateFormat DEFAULT


DateFormat.DEFAULT has the following syntax.

public static final int DEFAULT


In the following code shows how to use DateFormat.DEFAULT field.

//  ww  w.  ja  v a 2  s. c o m

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {
  public static void main(String[] argv) throws Exception {

    String s = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).format(new Date());


The code above generates the following result.