I want to show the date in format 22-Apr-2012.
I am using this code:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
sdf.applyPattern("dd MMM yyyy");
Date x = new Date(time.year,time.month,time.monthday);
System.out.println(sdf.format(x));
But i am getting o/p as:
22 apr 3912.
I want to know why it is showing 3912 in place of 2012.
Please read the api for Date class. It starts from year 1900 so in this constructor you must provide the date – 1900. But this constructor is deprecated so my advice is to start using Calendar object for your date related operations.
for Java.da