Parsing date with "dd/MM/yy" format in Java

Description

The following code shows how to parsing date with "dd/MM/yy" format.

Example


//ww  w  .  j  a va  2 s  .  c om
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

  public static void main(String[] args) throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
    Date date = sdf.parse("31/12/06");
    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