I myself tried computing magnetic field due to a finite current carrying wire using Ampere's law and I found the expression comes similar to the case of infinite wire. Obviously, there must be something wrong...
So I checked this on internet and found this
A solution giving physical sense to the finite wire is to put a source and a sink of electrical charge +q and −q at each extremity. It is then possible to have an electrical current I flowing along the wire (figure 2). The major point is now that both charges q(t) and −q(t) are time dependent and create an electrical field E(r) which is time dependent! Hence this problem is no longer a magnetostatics problem: we have to treat it in the more general framework of electromagnetism.
Then it says that as field is time dependent, therefore we need to use Maxwell Ampere's law.
But, what I don't understand is that how come the electric field is time dependent? Why is that necessary? And why are the charges time dependent? Is it because charges are flowing and thus need to be maintained continuously? I am not sure and hence asking here.
Also I want you to note that I'm studying this for the very first time and I'm not comfortable with complex higher maths. So, it would be nice if you restrict mathematical rigor in your answer as much as possible.
Please help me in this and I would be highly grateful.