The flying ants themselves can stay around for a month or longer but the flying ants lose their ability to fly within a week or two once they gain their wings.
You can get rid of flying ants by spraying the flying ants directly with dish soap or set out sticky tapes around where the flying ants are and they'll land on the sticky tape or sticky traps and be stuck on them.