Remove Leading "0" in day of month SimpleDateFormat

Denoteone picture Denoteone · Jan 12, 2012 · Viewed 34.5k times · Source

Is it possible to remove the "0" in January 04, 2012?

I am currently using the following Java to get the date format like

Monday, January 04, 2012

I would like for it to look like

Monday, January 4, 2012

    Date anotherCurDate = new Date();

    SimpleDateFormat formatter = new SimpleDateFormat("EEEE', 'MMMM dd', ' yyyy");  
    final String formattedDateString = formatter.format(anotherCurDate);

 final TextView currentRoomDate = (TextView)  this.findViewById(R.id.CurrentDate); 

Answer

Jave picture Jave · Jan 12, 2012
SimpleDateFormat formatter = new SimpleDateFormat("EEEE', 'MMMM d', ' yyyy");

Should do it (one 'd' instead of two)?

http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html