12 hour to 24 hour time converter Amazingly, this simple task doesn't seem to exist already, so...

Your task is to write a program that takes as input a 12 hour time,  and converts it into "military time", or 24-hour time format.

Input will be in the form:

HH:MM am/pm


Although slight variations are allowed:


The space separating the am/pm from the rest of the time is optional. 
The last part can either be "am"/"pm",  or "a"/"p". 
Any capitalization is fine. 


Output will be the inputted time, transformed into 24-hour format. It can be a number, or a string. 

For both the input and output:


0s in the first place are optional. 0s in the last 3 places are mandatory. 
the delimiter separating hours and minutes can be a ":", " " (a space), or nothing. 


Other notes:


Midnight can be expressed either as 0000, or 2400.
Midnight will be considered "am", while noon will be considered "pm". 


Your program can be a function, or a full program, and should either return the result, or output it to the stdout. Trailing whitespace is ok. 

Examples (you aren't required to support every format):

12:00am -&gt; 0000
1200 pm -&gt; 1200
1234Am  -&gt; 00:34
134a    -&gt; 134
01:34PM -&gt; 13 34
1234pm  -&gt; 1234  


This is code golf, so the smallest number of bytes wins. Since this is so trivial to solve using a built-in, it would be nice to see some code that manually solves this (but use of built-ins are fine). 

Just to clarify, you aren't required to support every possible format. Supporting only a single input and a single output format (of your choice) is fine. I would however like to limit the format as outlined above (which is already quite free). {1134,'pm'}, for example, would be unacceptable.
MATL, 4 bytes
15XO

Try it online!
Explanation
Built-in function: date string conversion with automatic detection of input format and with output format 15, which corresponds to 'HH:MM'. This is equivalent to @StewieGriffin's Octave answer.