Hi, I am from Taiwan (ROC).
2009 in our country year must minus 1911 and become 98.
2 years later (2011), our country year becomes 100.
"2009.01.08" I want to display "098.01.08" so I use the format "yyy.MM.dd"
but the result is "98.01.08".
If discare DAY_OF_WEEK problem.
Below is my code.
import java.text.SimpleDateFormat;
import java.util.Calendar;
class SimpleROCDateFormat extends SimpleDateFormat
{
SimpleROCDateFormat(String ptn)
{
super(ptn);
}
public String format(Calendar cal)
{
Calendar calendar = (Calendar)cal.clone();
calendar.add(Calendar.YEAR,-1911);
return super.format(calendar.getTime());
}
}
import java.util.*;
class test
{
public static void main(String args[])
{
Calendar now = Calendar.getInstance();
SimpleROCDateFormat sROCdf = new SimpleROCDateFormat("yyy.MM.dd");
String ROCnow = sROCdf.format(now);
System.out.println(ROCnow);
}
}
Wish your help. Thank you!!