Skills101
← All practice quizzes

Quiz: Date and Time in Java

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Work with dates the modern way using java.time. Create and change dates, find days between two dates and a person's age, format and parse with DateTimeFormatter, avoid the YYYY trap, and convert between time zones.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    import java.time.*;
    public class Main {
        public static void main(String[] args) {
            LocalDate d = LocalDate.of(2026, 5, 10);
            d.plusDays(5);
            System.out.println(d);
        }
    }
    
  2. Question 2

    In LocalDate.of(2026, 1, 15), which month is it?

  3. Question 3

    What does this print?

    import java.time.*;
    public class Main {
        public static void main(String[] args) {
            System.out.println(LocalDate.of(2026, 3, 31).plusMonths(1));
        }
    }
    
  4. Question 4

    You need the total number of days from today until an exam. Which is correct?

  5. Question 5

    Which class should hold a student's date of birth?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →