I had the same thing when my DS was little, he's 4 now and is basically totally out of it, he would also not take me seriously when I told him to stop so I had to get strict!!
I adopted a 0 tolerance rule, on the way to wherever we were going I would be constantly telling him
'No hitting, it hurt and makes people sad, come see mummy if you are upset' etc over and over, really drum it into him, then I would say just before we went in
'Remember no hitting, if you hit we will have to leave darling because it is not fair on other children to be hit' blah blah, I would always do this in a pleasant none confrontational way, then do as it says on the tin, if he hits, even once pull him aside calmly tell him
'You just hit X, that hurt X, mummy is going to take you home now'
And leave, we would talk about it from time to time, like 'remember when we had to leave X because you hit, that was horrible wasn't it, next time we can stay longer because you have learnt it's not ok to hit'
Don't dwell on it but make sure they are aware that it is them that are responsible and them that have the power to change it
I don't know if this is good bad or indifferent advice really, but it worked for my DS
Good luck, And try not to worry, I've seen no end of threads on this and friends have all gone through it, I think it's just a phase for most kids :)