013-003-004

Date Classes: Today's Date

Medium

Problem Description

Date Classes: Today's Date

In this problem, you will create a program that reads year, month, and day from standard input, uses LocalDate.of() to create a date object, and displays a formatted date string to standard output.

Learning Objective: Learn to handle dates using LocalDate class

Overview

The LocalDate class from Java 8+ makes date handling easy. Create and display a date from values read from input.

Input Format

year
month
day

Specifications

  • Read year, month, and day as integers from standard input
  • Create a date object using LocalDate.of()
  • Display the date

Output Format

Date: YYYY-MM-DD

Example

Input:

2024
1
15

Output:

Date: 2024-01-15

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up