Actually the poem that the song was based on was written in 1814 but..........
The Star-Spangled Banner" was recognized for official use by the United States Navy in 1889, and by U.S. President Woodrow Wilson in 1916, and was made the national anthem by a congressional resolution on March 3, 1931 ...
— LiberalForum Archive