Is there a oneliner to get the name of the month when we know
int monthNumber = calendar.get(Calendar.MONTH)
Or what is the easiest way?
See Question&Answers more detail:osIs there a oneliner to get the name of the month when we know
int monthNumber = calendar.get(Calendar.MONTH)
Or what is the easiest way?
See Question&Answers more detail:osyou can achieve it using SimpleDateFormat, which is meant to format date and times.
Calendar cal = Calendar.getInstance();
System.out.println(new SimpleDateFormat("MMM").format(cal.getTime()));