Skip to main content
5 of 8
added 66 characters in body
Suever
  • 11.2k
  • 1
  • 23
  • 52

#MATL, 18 14 bytes

4:&)XhZc12XOXk

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
4:&)    % Break into the first 4 characters (the year) and the last two (the month)
Xh      % Combine these two parts into a cell array
Zc      % Join them together with a space in between
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

Try it Online

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
Suever
  • 11.2k
  • 1
  • 23
  • 52