Your ex boyfriend texted you Happy Birthday because he still has some feelings of civility towards you, but he waited until late at night because he didn’t want to be part of your big day. It was an after thought.
Don’t think too much about it. If he told you to get lost, then do yourself a favor and look elsewhere for love.