Java Format - Java DateFormat LONG








Syntax

DateFormat.LONG has the following syntax.

public static final int LONG

Example

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

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
/*from  ww w  .  j  a  va2  s  . c  om*/
public class Main {
  public static void main(String[] argv) throws Exception {

    String s = DateFormat.getTimeInstance(DateFormat.LONG, Locale.CANADA).format(new Date());
    System.out.println(s);

  }
}

The code above generates the following result.