Java DateFormat DEFAULT

Syntax

DateFormat.DEFAULT has the following syntax.

public static final int DEFAULT

Example

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


//ww  w  . ja  v  a2s  .  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());
    System.out.println(s);

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat