C 136C (clang), 94 bytes
Input format 12:00am
f(){h,m a,b;scanf("%d:%d%c%c",&h,&m,&a,&b);if(a=='a'&&b=='m') printf("%02d%02d",h%12,m);if(a=='p'&&b=='m')printf("%02d%02d",12+h%12,m);}
h,m;f(){char a,b;scanf("%d:%d%c%c",&h,&m,&a,&b);printf("%02d%02d",a=='a'?(h%12):(12+h%12),m);}
Normal readable format:Try it online!
void f()
{
int h,m;
char a,b;
scanf("%d:%d%c%c",&h,&m,&a,&b);
if(a=='a'&&b=='m')
printf("%02d%02d\n",h%12,m);
if(a=='p'&&b=='m')
printf("%02d%02d\n",12+h%12,m);
}
I'm here to learn, so any tips on how i can optimize the code are welcome.
@ Johan du Toit Thanks, for saving a few bytes!