1Z0-805 · Question #51
Given the code format: SimpleDateFormat sdf; Which code statements will display the full text month name?
The correct answer is D. sdf = new SimpleDateFormat ("MMMM", Locale.UK). To getthe full length month name use SimpleDateFormat('MMMM'). Note: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…
Question
Given the code format:
SimpleDateFormat sdf; Which code statements will display the full text month name?
Options
- Asdf = new SimpleDateFormat ("mm", Locale.UK);
- Bsdf = new SimpleDateFormat ("MM", Locale.UK);
- Csdf = new SimpleDateFormat ("MMM", Locale.UK);
- Dsdf = new SimpleDateFormat ("MMMM", Locale.UK);
How the community answered
(32 responses)- A3% (1)
- B13% (4)
- C6% (2)
- D78% (25)
Explanation
To getthe full length month name use SimpleDateFormat('MMMM'). Note: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. However, you are encouraged to create a date-time formatter with either getTimeInstance, getDateInstance, orgetDateTimeInstance in DateFormat. Each of these class methods can return a date/time formatter initialized with a default format pattern. You may modify the format pattern using the applyPattern methods as desired.
Topics
Community Discussion
No community discussion yet for this question.