Depends on person. Depends on how much of a habit you had, and how long your were taking it, as well as your own individual biology. In general, sleep problems persist for a week or two, then generally get better. Avoidance of caffeine, especially after noon, good sleep hygiene are generally adequate. Chamomille tea and other natural agents may help. Avoid sleeping pills since they will make it worse later.
Days. There is no definite answer to that. Physical withdrawal may take a few days to 1-2 weeks in some cases, and this may be manifested with insomnia. Whether your sleep will go back to normal, once that is over, I don't know and no one will guarantee. Psychological withdrawal, however, doesn't stop there and that, in and of itself, may be a stumbling block for your sleep to return to normal.