Courseiva

1Z0-829 Practice Question: Handling Date, Time, Text, Numeric and Boolean Values

Which of the following correctly uses DateTimeFormatter to parse the date "2023-01-15" into a LocalDate?

⚠ Common exam trap

It's easy for candidates to confuse lowercase `mm` (minute) with uppercase `MM` (month) in date/time patterns, leading them to choose option B, or they forget that `MonthDay.parse()` requires a specific format without a year, causing them to select option C.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

LocalDate.parse("2023-01-15", DateTimeFormatter.ofPattern("yyyy-MM-dd"))

Options A and D are both correct. Option A uses DateTimeFormatter.ofPattern("yyyy-MM-dd") with the correct pattern, which parses the date successfully. Option D uses the predefined constant DateTimeFormatter.ISO_LOCAL_DATE, which also correctly parses the input "2023-01-15". Option B is wrong because lowercase "mm" represents minutes, not months. Option C is wrong because MonthDay.parse() expects a format like "--01-15" without a year.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • LocalDate.parse("2023-01-15", DateTimeFormatter.ofPattern("yyyy-MM-dd"))

    Why this is correct

    Correct. The pattern 'yyyy-MM-dd' matches the input format exactly.

  • LocalDate.parse("2023-01-15", DateTimeFormatter.ofPattern("yyyy-mm-dd"))

    Why it's wrong here

    Incorrect. The pattern uses lowercase 'mm' for minutes instead of uppercase 'MM' for month, causing a parsing error.

  • MonthDay.parse("2023-01-15")

    Why it's wrong here

    Incorrect. MonthDay.parse() expects a format like '--01-15' without a year, so it fails on a full date string.

  • LocalDate.parse("2023-01-15", DateTimeFormatter.ISO_LOCAL_DATE)

    Why this is correct

    Correct. DateTimeFormatter.ISO_LOCAL_DATE is a predefined format that matches ISO-8601 date format (yyyy-MM-dd), so it parses the input correctly.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.