Java SimpleDateFormat .set2DigitYearStart (Date startDate)

Syntax

SimpleDateFormat.set2DigitYearStart(Date startDate) has the following syntax.

public void set2DigitYearStart(Date startDate)

Example

In the following code shows how to use SimpleDateFormat.set2DigitYearStart(Date startDate) method.


/*from   w w w  .ja v a 2  s  .  c om*/
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.SimpleDateFormat;
import java.util.Date;

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

    SimpleDateFormat formatter = new SimpleDateFormat("yy");
    formatter.set2DigitYearStart(new Date());
    
    System.out.println(formatter.format(new Date()));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat