I did noticed the k modifier has a side effect of adjusting the hour, but this behavior is odd - and doesn't allow for just getting a 12 hour string back, you could only get a 24 hour string or a 12 hour string with AM/PM.
Also, the logic there leads to a 0 AM/00 AM and not a 12 AM time 12 PM is accounted for fine.
I did noticed the k modifier has a side effect of adjusting the hour, but this behavior is odd - and doesn't allow for just getting a 12 hour string back, you could only get a 24 hour string or a 12 hour string with AM/PM.
Also, the logic there leads to a 0 AM/00 AM and not a 12 AM time 12 PM is accounted for fine.