Converting Month Number to Month Name In Java!
How long have I wanted to know how to do this! So long so many months! Finally:
import java.text.*;
String getMonthForInt(int m) {
String month = "invalid";
DateFormatSymbols dfs = new DateFormatSymbols();
String[] months = dfs.getMonths();
if (m >= 0 && m <= 11 ) {
month = months[m];
}
return month;
}
Praise the lord! Praise the lord!
About this entry
You’re currently reading “ Converting Month Number to Month Name In Java! ,” an entry on bluebones.net
- Published:
- 2002.10.08
- Category:
- Programming
13 Comments
Jump to comment form | comments rss [?]