nerdexam
Oracle

1Z0-805 · Question #53

Given the code fragment: SimpleDateFormat sdf; Which code fragment displays the two-digit month number?

The correct answer is B. sdf = new SimpleDateFormat ("MM", Locale.UK). B: Output example (displays current month numerically): 04 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. Oracle 1Z0-805 Exam…

Localization

Question

Given the code fragment:

SimpleDateFormat sdf; Which code fragment displays the two-digit month number?

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

(20 responses)
  • A
    5% (1)
  • B
    75% (15)
  • C
    5% (1)
  • D
    15% (3)

Explanation

B: Output example (displays current month numerically): 04 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. Oracle 1Z0-805 Exam 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

#SimpleDateFormat#date formatting#MM pattern#Locale

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice