DD is 20 months.
she does hit sometimes, but it's usually because she doesn't understand that she's being hard.
she is also bloody selfish when it comes to toys, and will snatch a toy if she feels it's "hers"
that does come in handy when little children (usually older) snatch a toy off her when she had it first.
when she's in the wrong, I always go to her "no! you must not hit people!" and do the stern face and move her arm away.
if it's because she doesn't understand it hurts (ie, she's trying to be friendly), then I say "gently, DD, you can touch, but do it nicely."
i think it's all in the tone of voice at this age, but even then, they don't quite understand.
But to not do anything about it as the parent is wrong - even if they don't quite understand, if you always say "no, that's not nice" or other stern phrases, then the child will eventually get the message that it's not nice.
I think by 2, it should be sinking in. even 20month DD is working out when i'm being funny and when I'm not.