How long can piles take to go?

A long time. Depending on the treatment used. They may never go away in some cases. Hope this helps!
To go away? If you mean to go away, they are normal structures and short of surgery they will not go away. If you mean swelling and pain, then eating and drinking proper fluids and diet, they should resolve in 3-14 days. If not get them checked out properly by a specialist.