54
5
Basing on this SO question.
Challenge is rather simple: given a date period in the format YYYYMM
output it in the format MMMYY
.
Rules:
- The input will be a number or a string exactly 6 characters long, consisting only of digits.
- Last two digits will be between
01
and12
. - Output must be in the form
MMMYY
, whereMMM
represents uppercase three-letter code for the month (below) andYY
represents two last digits of theYYYY
part of the input.
List of months with corresponding code:
MM MMM
01 JAN
02 FEB
03 MAR
04 APR
05 MAY
06 JUN
07 JUL
08 AUG
09 SEP
10 OCT
11 NOV
12 DEC
Examples:
Input Output
201604 APR16
200001 JAN00
000112 DEC01
123405 MAY34
5This question is very well-balanced. Both manual parsing and date libraries end up being about the same, at least in Python. – jqblz – 2016-06-22T20:32:44.537
10Yesterday, I saw "Convert YYYYMM to MMMYY" on HNQ beside the SO logo. Now I see the same title beside the PCG logo. I was very confused :) – cat – 2016-06-23T14:30:24.287