Reformat · Medium

Dates to YYYY-MM-DD

Dates are written like "5 March 2024" or "5 Mar 2024", one per line.

Task

Write a prompt that rewrites every date as YYYY-MM-DD.

Output format

one date per line, YYYY-MM-DD

  • Keep the same order as the input.
  • Use 2 digits for the month and the day (03, 05).

Your prompt must contain {input}: it is replaced by each test case, just like the hidden tests in a hiring test.

Sample case 1
Input
5 March 2024
Output
2024-03-05
Sample case 2
Input
12 Dec 2023
1 Jan 2024
Output
2023-12-12
2024-01-01

There are 4 test cases in all; the others are like hidden tests: work out what tricky inputs they might use!

Loading the editor…