question 53 Strings & Text · easy
A readable complaint time
The CFPB stores when a complaint arrived as 2024-01-15T00:01:21.000Z. A case worker's screen shows it as 15 Jan 2024, 00:01 UTC: the day without a leading zero, a three-letter month, the year, then the hours and minutes. You have no lists yet, but you don't need one: all twelve month names fit in one text, three letters each, and a slice can pick out the right three.
Input
received, a timestamp in the form YYYY-MM-DDTHH:MM:SS.000ZGiven
months = "JanFebMarAprMayJunJulAugSepOctNovDec"Prints
<day> <Mon> <year>, <HH:MM> UTC, with the day as a plain number (5, not 05)Examples
"2024-01-15T00:01:21.000Z" → 15 Jan 2024, 00:01 UTC; "2024-12-05T23:59:59.000Z" → 5 Dec 2024, 23:59 UTCExpected output1 line
- 115 Jan 2024, 00:01 UTC