0

My date is displayed in a button in this format

new SimpleDateFormat("EEEEEEEEEE MMMM dd yyyy")

i.e.

wednesday 15 may 2013

But i want to capitalised each starting element i.e.

Wednesday 15 May 2013
laalto
  • 144,748
  • 64
  • 275
  • 293
Dimitri
  • 679
  • 3
  • 19
  • 46

3 Answers3

2

It'll give what you want, why is it not working at your end:

    Date date = new Date();
    SimpleDateFormat format = new SimpleDateFormat("EEEEEEEEEE dd MMMM yyyy") ;
    System.out.println(format.format(date));

"Wednesday 15 May 2013"

vishal_aim
  • 7,146
  • 1
  • 19
  • 23
1

Four times E is enough:

SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd MMMM yyyy");

Where EEEE is the day of week long.

From Javadoc if the number of pattern letters is 4 or more, a calendar specific long form is used

stacker
  • 66,311
  • 27
  • 138
  • 208
0

trying with Below Way also will solve your Problem.

SimpleDateFormat format= new SimpleDateFormat("EEEEEEEEEE MMMM dd yyyy", Locale.US);
Bhavesh Patadiya
  • 25,674
  • 15
  • 78
  • 106