Description

Given a date string in the format "Day Month Year" where Day is in the set {1st, 2nd, ..., 31st}, Month is in {Jan, Feb, ..., Dec}, and Year is in range [1900, 2100], convert it to the format "YYYY-MM-DD".

Examples

Input:date = "20th Oct 2052"
Output:"2052-10-20"
Explanation:

Reformat date.

Input:date = "1st Jan 2000"
Output:2000-01-01
Explanation:

Convert the first day of January in year 2000 to ISO format, padding single digits with leading zeros.

Input:date = "31st Dec 1999"
Output:1999-12-31
Explanation:

Convert the last day of December in year 1999 to ISO format, demonstrating end-of-year date formatting.

Constraints

  • Date is valid

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!