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
  • 150,114
  • 66
  • 286
  • 303
Dimitri
  • 677
  • 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,636
  • 1
  • 20
  • 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
  • 68,052
  • 28
  • 140
  • 210
0

trying with Below Way also will solve your Problem.

SimpleDateFormat format= new SimpleDateFormat("EEEEEEEEEE MMMM dd yyyy", Locale.US);
Bhavesh Patadiya
  • 25,740
  • 15
  • 81
  • 107