Java Date parse String like "31/12/06"

Description

Java Date parse String like "31/12/06"

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
  public static void main(String[] args) {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
    try {/*www . j av  a 2s. com*/
      Date date = sdf.parse("31/12/06");
      System.out.println(date);
    } catch (ParseException pe) {
      System.out.println("Parse Exception : " + pe);
    }
  }
}



PreviousNext

Related