How far in advance to ask someone out?

In my experience, it’s not that easy; there is always ambiguity, and a chance to misunderstand.