Parse string date value with default format in Java

Description

The following code shows how to parse string date value with default format.

Example


//from  w  ww. j  a  v  a2  s  . co m
import java.text.DateFormat;
import java.util.Date;

public class Main {
  public static void main(String[] argv) throws Exception {

    Date date = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Feb 28, 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