Reformat Date

Problem Convert a date from "Day Month Year" (Day ∈ {"1st","2nd",…,"31st"}, Month ∈ {"Jan",…,"Dec"}, Year ∈ [1900, 2100]) to ISO "YYYY-MM-DD".

Input / Output

  • Input: string like "20th Oct 2052".
  • Output: "2052-10-20".

Constraints

  • Input guaranteed valid — the exercise is clean parsing/formatting, not validation (but mention what validation you'd add).

Example

  • "6th Jun 1933" → "1933-06-06"; "26th May 1960" → "1960-05-26".
asked …
LeaderboardSalaryAccount