Java Format - Java DateFormat .getDateInstance (int style, Locale aLocale)








Syntax

DateFormat.getDateInstance(int style, Locale aLocale) has the following syntax.

public static final DateFormat getDateInstance(int style,    Locale aLocale)

Example

In the following code shows how to use DateFormat.getDateInstance(int style, Locale aLocale) method.

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
// w w  w  .j a v a  2 s  . co m
public class Main {
  public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG,Locale.getDefault());
    
    
    String s = dateFormat.format(new Date());
    System.out.println(s);

  }
}

The code above generates the following result.