Charles XII ( Swedish : Karl XII ) was the king of Sweden from 1697 to 1718 . He was born on June 27 , 1682 . Charles XII also Carl of Sweden , , Latinized to Carolus Rex , Turkish : DemirbaÅ Å arl , also known as Charles the HabituÃ ( 17 June 1682 â `` 30 November 1718 ) was the King of Sweden from 1697 to 1718 .