Title: The Star-Spangled Banner
Content:  When the U.S. national anthem was first recognized by law in 1931, there was no prescription as to behavior during its playing. On June 22, 1942, the law was revised indicating that those in uniform should salute during its playing, while others should simply stand at attention, men removing their hats. The same code also required that women should place their hands over their hearts when the flag is displayed during the playing of the national anthem, but not if the flag was not present. On December 23, 1942, the law was again revised instructing men and women to stand 
Title: U.S. national anthem protests (2016–present)
Content:  It is a tradition in the United States to play "The Star-Spangled Banner", the national anthem, before sporting events. According to the United States Code, those present should stand at attention with right hand over heart. National Football League (NFL) players were not mandated to be on the field for the playing of the national anthem until 2009. In 2016 the NFL stated that "players are encouraged but not required to stand during the playing of the National Anthem"; its game operations manual reads that players "should stand" for the anthem. The people of the United States are widely divided on the intended meaning of the anthem. Some believe it salutes military and police 
Title: The Star-Spangled Banner
Content:  anthem became nearly universal. Since 1998, federal law (viz., the United States Code ) states that during a rendition of the national anthem, when the flag is displayed, all present including those in uniform should stand at attention; non-military service individuals should face the flag with the right hand over the heart; members of the Armed Forces and veterans who are present and not in uniform may render the military salute; military service persons not in uniform should remove their headdress with their right hand and hold the headdress at the left shoulder, the hand being over the heart; 
Title: U.S. national anthem protests
Content:  In the 1960s, refusal to stand during the anthem took place for a number of reasons. In the late 1960s, the protest became increasingly common among athletes and at schools, both as a protest of the Vietnam War and as a protest of nationalism. In December 1968, Chris Wood, co-captain of the Adelbert College basketball team was removed from the team for not standing, saying, "We believe in the fellowship of man. We don't believe in nationalism." Five white high school students were suspended in Cumberland, Maryland in February 1970. A federal judge Joseph P. Kinneary ordered reinstatement of a pair of students in Columbus, Ohio, saying that forcing anyone to participate in "symbolic patriotic ceremonies" against their will was a violation of the First Amendment to the US Constitution. In November 1970, Kaye Stevens refused to sing the national anthem before an NFL game between the Pittsburgh Steelers 
Title: The Star-Spangled Banner
Content:  case, the tradition of performing the national anthem before every baseball game began in World War II. On April 10, 1918, John Charles Linthicum, U.S. congressman from Maryland, introduced a bill to officially recognize "The Star-Spangled Banner" as the national anthem. The bill did not pass. On April 15, 1929, Linthicum introduced the bill again, his sixth time doing so. On November 3, 1929, Robert Ripley drew a panel in his syndicated cartoon, Ripley's Believe it or Not!, saying "Believe It or Not, America has no national anthem". In 1930, Veterans of Foreign Wars started a petition for the United States to officially recognize "The Star-Spangled Banner" as the national anthem. Five million people signed 
Title: The Star-Spangled Banner
Content:  right hand over the heart, if out of uniform. The law was amended in 2008, and since allows military veterans to salute out of uniform, as well. The text of is suggestive and not regulatory in nature. Failure to follow the suggestions is not a violation of the law. This behavioral requirement for the national anthem is subject to the same First Amendment controversies that surround the Pledge of Allegiance. For example, Jehovah's Witnesses do not sing the national anthem, though they are taught that standing is an "ethical decision" that individual believers must make based on their conscience.
Title: U.S. national anthem protests
Content:   Protests during the playing of the United States national anthem have had many causes, including civil rights, anti-conscription, anti-war, anti-nationalism, and religious reservations. Such protests have occurred since at least the 1890s, well before "The Star-Spangled Banner" was adopted and resolved by Congress as the official national anthem in 1916 and 1931, respectively. Earlier protests typically took place during the performance of various unofficial national anthems, including "My Country, 'Tis of Thee" and "Hail, Columbia". These demonstrations may include refusal to stand or face the American flag during the playing of the Anthem.
Title: National anthem
Content:  did not yet have an officially defined national anthem to introduce one. The United States introduced the patriotic song The Star-Spangled Banner as a national anthem in 1931. Following this, several nations moved to adopt as official national anthem patriotic songs that had already been in de facto use at official functions, such as Mexico (Mexicanos, al grito de guerra, composed 1854, adopted 1943) and Switzerland ("Swiss Psalm", composed 1841, de facto use from 1961, adopted 1981). By the period of decolonisation in the 1960s, it had become common practice for newly independent nations to adopt an official national anthem. Some of these anthems were specifically commissioned, 
Title: U.S. national anthem protests (2016–present)
Content:  black people faced and the other group that believed kneeling was disrespectful to the country, flag, or the military. To address the backlash, the NFL released a national anthem policy in May 2018, stating that players and team personnel were required to stand during the national anthem. Those who chose not to stand were required to remain in the locker room. Though NFL commissioner Roger Goodell said the vote was unanimous among all NFL owners, Jed York, the owner of the San Francisco 49ers and Kaepernick's previous team said he abstained. During an interview, President Trump said that the NFL did "the right thing" of releasing the new policy. He added, "You have to stand proudly for the national anthem or you shouldn’t 
Title: National Anthem Ordinance
Content:  and require attendees at events to stand up straight "solemnly" when the anthem plays. Those who violate the new law, including those who modify the lyrics or mock the song or play it during "inappropriate" occasions, could be detained for up to 15 days or face criminal prosecution. On 4 November 2017, the NPCSC adopted the decision to add the National Anthem Law to Annex III of the Basic Law of Hong Kong. In accordance with Article 18(2) of the Basic Law, the national laws listed in Annex III to the Basic Law shall be applied locally by way of promulgation or legislation by the Hong Kong Special Administrative Region (HKSAR).

Question: when did it become law to stand for the national anthem?
Answer: June 22, 1942.