🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Date and Time in Java: all 10 questions

Quiz: Date and Time in Java · Question 8 of 10

Why might a date formatted with "YYYY" show the wrong year in late December?

Why might a date formatted with "YYYY" show the wrong year in late December?

  1. A.YYYY is not a valid pattern
  2. B.YYYY is the week-based year, which can already be the next year in the last days of December
  3. C.YYYY always prints two digits
  4. D.YYYY uses the Hindu calendar
Answer & explanation

Correct answer: YYYY is the week-based year, which can already be the next year in the last days of December

Use lowercase yyyy for the normal calendar year.

Can you get the rest right without peeking?

Take the timed Quiz: Date and Time in Java quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →