Common sense should tell you that one pill will not show up in your urine for 2 week/half a month.
Anyways, on to your answer: 2-3 days will do. I'd say more than likely 48 hours and you will be straight to pass a urine test. If you want to be super safe wait 72 hours- but don't worry if you only have 48 hours before the test. Be sure to drink a lot of water if you are trying to get it out sooner. Xanax is water soluble-- which means drinking water will removed the chemicals from your system. If you have a prescription then you can continue to take the medication and will not be in trouble for having it in your system. Simply, show the person conducting the test you have a valid prescription. If you don't have a drug test then don't even worry and keep on doing your thang!