Parse string date value input with dd-MMM-yy format in Java

Description

The following code shows how to parse string date value input with dd-MMM-yy format.

Example


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

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

    Format formatter = new SimpleDateFormat("dd-MMM-yy");
    Date date = (Date) formatter.parseObject("29-Jan-02");
    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