Convert int months to names
Hi Friends,
Is there a direct way to convert months (int) to months(name-wise).
Example, if someone enters 1 ,it should display it as Jan.
import java.util.*;
import java.text.*;
publicclass jDate{
publicstaticvoid main ( String args [ ] )
{
SimpleDateFormat sdf =new SimpleDateFormat ("yyyy-MM-dd" ) ;
Calendar cal = Calendar.getInstance ( ) ;
cal.set(2007,02,27);
System.out.println ("Date: " + sdf.format (cal.getTime())) ;
}
}
Actual Output: Date: 2007-03-27
ExpectedOutput: Date: Feb 27,2007
Or do I need to do some processing like:
String[] months = {"Jan","Feb",...."Dec"};
Thanks

