Tap here to switch tabs
Problem
Submissions

Problem: Reformat Date

med
30 min
Try to solve the Reformat Date problem.

Statement

Given a date string date in the format "Day Month Year", convert and return the date reformatted as "YYYY-MM-DD".

The input components are defined as follows:

  • Day is in the format {"1st", "2nd", "3rd", "4th", ..., "31st"}.

  • Month is in the format {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}.

  • Year is in the range [1900,2100][1900, 2100].

The converted format requires the year to be a 44 digit number, the month to be a 22 digit number with a leading zero if necessary, and the day to be a 22 digit number with a leading zero if necessary.

Constraints:

  • The given dates are guaranteed to be valid, so no error handling is necessary.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reformat Date

med
30 min
Try to solve the Reformat Date problem.

Statement

Given a date string date in the format "Day Month Year", convert and return the date reformatted as "YYYY-MM-DD".

The input components are defined as follows:

  • Day is in the format {"1st", "2nd", "3rd", "4th", ..., "31st"}.

  • Month is in the format {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}.

  • Year is in the range [1900,2100][1900, 2100].

The converted format requires the year to be a 44 digit number, the month to be a 22 digit number with a leading zero if necessary, and the day to be a 22 digit number with a leading zero if necessary.

Constraints:

  • The given dates are guaranteed to be valid, so no error handling is necessary.