In 1898 the war between Spain and the United States was over, which was confirmed by the Treaty of Paris. Spain surrendered the Philippines to the USA, but the Filipinos started a revolt in order to get their country independent. We achieved it on 4th July 1946 through the Treaty of Manila.
But it was on 12th July 1898 when first Declaration of Independence was made by General Emilio Aguinaldo. Unfortunately it was not recognized by both Spain and USA, and we had to wait until 1946 to get freedom. That's why we celebrate the anniversary on 12th June, instead of 4th July. The holiday was established by the President Diosdado Macapagal who signed the Republic Act No. 4166 in 1946.