When did guns officially replace the sword? When was the last battle to primarily use swords?

by 1squidwardtortellini
1991tank

No battle primarily used swords. Swords by there nature are sidearms the real figting was done with polearms and missle weapons. so the transition was more or less a few primative guns and artillery to arquebuesiers becoming a staple of warfare to the widespread adoption of the bayonet eliminating pikeman and machine guns eliminating the last true hand weapon using unit the calvaryman