#MATL, 18 14 13 bytes
MATL, 18 14 13 bytes
4e!Z{Zc12XOXk
Input is provided as a string (enclosed in single quotes).
This version only runs in MATL on MATLAB since MATLAB is able to automatically parse datestr('2016 04')
.
Explanation
% Implicitly grab input as a string
4e! % Reshape input to be 2 x 4 (puts the year in row 1 and month in row 2)
Z{ % Place each row in a separate cell
Zc % Join them together using a space to create 'yyyy mm' format
12 % Number literal, pre-defined datestring of 'mmmyy'
XO % Convert from serial date number to string using this format
Xk % Convert to uppercase
% Implicitly display
Here is an 18 byte version which works on Octave (and therefore the online interpreter)
'yyyymm'2$YO12XOXk
Modified version for all test cases
Explanation
% Implicitly grab input as a string
'yyyymm' % Push the format string as a string literal
2$YO % Convert to a serial date number
12 % Number literal, pre-defined datestring of 'mmmyy'
XO % Convert from serial date number to string using this format
Xk % Convert to uppercase
% Implicitly display