Parse with a default medium format in Java

Description

The following code shows how to parse with a default medium format.

Example


/* w  w w  .j a v  a  2s  .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 {

    Date date = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.CANADA).parse("29 janv. 2002");
    System.out.println(date);
  }
}

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