You can remember the meaning of 午夜 with this easy mnemonic:
I'm always hungry, from noon (午), to night (夜), and even midnight!
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.