WW2 was a global war that lasted from 1939 to 1945, although related conflicts began earlier. It involved the vast majority of the world’s countries—including all of the great powers.
So when did WW2 end? In the European theatre of war the Axis German forces surrendered in Italy on 29 April. Total and unconditional surrender was signed on 7 May, to be effective by the end of 8 May. (Althouth a German Army Group Centre resisted in Prague until 11 May).
The Allies called for unconditional Japanese surrender in the Potsdam Declaration of 27 July, but the Japanese government rejected the call. In early August, the USAAF dropped atomic bombs on the Japanese cities of Hiroshima and Nagasaki. Between the two bombings, the Soviets, pursuant to the Yalta agreement, invaded Japanese-held Manchuria, and quickly defeated the Kwantung Army, which was the largest Japanese fighting force. The Red Army also captured Sakhalin Island and the Kuril Islands.
On 15 August 1945, Japan surrendered, with the surrender documents finally signed at Tokyo Bay on the deck of the American battleship USS Missouri on 2 September 1945, ending the war on all fronts.