Converting Month Number to Month Name In Java!

 08 Oct 2002 | Programming

How long have I wanted to know how to do this! So long so many months! Finally:

import java.text.*;

function 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!

Comment on 'Converting Month Number to Month Name In Java!'


Other sites I am involved with: The Poor School - Acting Training in London | idRisk | Perspicientiae | The New Hacker's Dictionary (archived copy) | My Lomohome