Format date in Long format in Java

Description

The following code shows how to format date in Long format.

Example


/*from w w w.ja v  a  2 s  . com*/
import java.text.DateFormat;

import java.util.Date;

public class Main {
  public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);

    System.out.println(strDate);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Date »




Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse
Timezone