You can remember the meaning of 半夜 with this easy mnemonic:
Half (半) way through the night (夜), around midnight, I always hear someone knocking at my door.
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.