Java Format - Java DateFormat .getDateTimeInstance (int dateStyle, int timeStyle, Locale aLocale)








Syntax

DateFormat.getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) has the following syntax.

public static final DateFormat getDateTimeInstance(int dateStyle,    int timeStyle,    Locale aLocale)

Example

In the following code shows how to use DateFormat.getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) method.

//from  w ww  .ja  va2  s .  c om
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {
  public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG,
        DateFormat.LONG,Locale.getDefault());
    
    
    String s = dateFormat.format(new Date());
    System.out.println(s);

  }
}

The code above generates the following result.