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". Return the result as a string.
Examples
Input:
date = "20th Oct 2052"Output:
"2052-10-20"Explanation:
Parse '20th' as day 20, 'Oct' as month 10, '2052' as year. Format as YYYY-MM-DD: 2052-10-20.
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