Answer:
There are several answers to this question.
As Lewis Carroll made up Alice in Wonderland as he went along, one afternoon in 1865, to entertain some children he knew, you could say that it took him no time at all to write it.
One of the children loved the story and asked him to write it down for her. It took Carroll two years from when he was asked until he gave her the version he wrote down for her.
He then decided to have the book published, so he edited, added to and rewrote the hand written version and it was finally published exactly three years after he first made up the story.