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?
you 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()));
2.1m questions
2.1m answers
60 comments
57.0k users