Given the code format:
<code>
SimpleDateFormat sdf;
</code>
Which code statements will display the full text month name?
A.
sdf = new SimpleDateFormat (“mm”, Locale.UK);
System.out.println ( “Result: ” + sdf.format(new Date()));
B.
sdf = new SimpleDateFormat (“MM”, Locale.UK);
System.out.println (“Result:”+ sdf.format(new Date()));
C.
sdf = new SimpleDateFormat (“MMM”, Locale.UK);
System.out.println (“Result:”+ sdf.format(new Date()));
D.
sdf = new SimpleDateFormat (“MMMM”, Locale.UK);
System.out.println (“Result:”+ sdf.format(new Date()));
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.