My first one, a couple years. I started learning how to code when I was somewhere between 8-10.
But, I had a beta open (a simple signup, login, and profile page) done in about a week. It would take a week or more to add another feature, like a bank, or a store. Then, a couple hours to, say, add items to the store.
The hardest part was the fighting because it used a lot of different loops to see who would attack first, and then with what weapon, how strong, if they even hit, because it'd check if the other player had more speed, etc. The fighting took about an entire month to get a beta down, and then I refined that day by day as it was the focal point.
The next was treasure hunting on a map. It took a while to visualize a grid and then randomly place items for a "pet" to walk from bottom left corner to take a step right and step up to discover something like currency or items that couldn't be bought. Which leads me to the secondary marketplace, where users could sell items they found.
Development of the game to where I left off was about 1 1/2 years...