Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SimpleDateFormat month name with uppercase [duplicate]

How to change the month name to uppercase. Anyone know about this?

This is my example condition:

(new SimpleDateFormat("MMMM yyyy")).format($P{date_start})
like image 659
Amin SCO Avatar asked Nov 28 '12 12:11

Amin SCO


People also ask

What is the format of SimpleDateFormat?

Java SimpleDateFormat with Locale String pattern = "EEEEE MMMMM yyyy HH:mm:ss.

Is SimpleDateFormat case sensitive?

The formats are case-sensitive. Use yyyy for year, dd for day of month and MM for month. You need to read the javadoc of SimpleDateFormat more carefully, Take special care for lower-case and upper-case in the patterns.

Is SimpleDateFormat a String?

SimpleDateFormat also supports localized date and time pattern strings. In these strings, the pattern letters described above may be replaced with other, locale dependent, pattern letters. SimpleDateFormat does not deal with the localization of text other than the pattern letters; that's up to the client of the class.

What is the use of SimpleDateFormat?

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization. SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting.


1 Answers

Use .toUpperCase() , as follows:

(new SimpleDateFormat("MMMM yyyy")).format($P{date_start}).toString().toUpperCase()
like image 60
Nelson Avatar answered Oct 11 '22 06:10

Nelson