We don’t measure the quality of a meal only by the time it took to make, believing the longer it takes the better is inherently is. It’s the end result that’s judged, though the time is an aspect we may think about as we eat it and certainly plays its part in the quality of the end result.
When someone asks “how long did it take you to paint?”, don’t answer the question. It’s an invitation to engage them about the painting, and youself. Say a couple of things about what was involved in creating it, your inspiration, technique, favourite aspects. (Who doesn’t have a favourite bit in a painting that you’re particularly pleased about that you could point too?)
For many people the question is more a statement of enjoyment of the painting than anything, a safe way to talk to an artist without embarrassing themselves. (The underlying fear is that liking a painting isn’t enough, you must know something about art to appreciate a painting. Not true, of course.) If you answer the question straight away, the conversation is over and they’ll move on.
Would you ever ask “How long did it take you to make this cake?” or would you say “What’s in this cake?”