If the Sun exploded this instant, how long would it be before we knew?
As others have mentioned, it takes about 8 minutes for light from the sun to reach the earth. One thing that's not being discussed is how quickly an explosion of a star might progress. Firstly, we should note that this is unlikely to happen to our sun, as it's not massive enough to end in a supernova, however, a supernova is what we call an exploding star. Our current understanding of supernovae is that they progress along the following lines:
Core collapse in less than a second.
A few hours for the shockwave to reach the surface.
A few months to brighten
Matter may be ejected at speeds as high as 13km per second, but that would take about 133 days to reach earth. (Edit: Previously miscalculated this as thousands of years) What would be more problematic is the brightening of the star mentioned above over several months. Supernovae are typically several orders of magnitude brighter than their star was, so we could be talking about the power per unit area reaching the planet to increase perhaps 1000 fold or more. This would rapidly increase the temperature of the earth to the point where it is uninhabitable for pretty much all life.
So, from the start of the event, it would take a few hours for the shock wave to reach the surface and another 8 minutes from that point for anyone on earth to be able to observe anything, then a few months of rapid brightening of the sun. While it may be true that governments and astronomical organizations may observe this first and may possibly decide to suppress the information, it wouldn't take that long before the effects of brightening were apparent to everyone and everything on the planet.
Having said all that, based on our current understanding of celestial bodies, we don't believe this is likely to ever happen to our sun. It will eventually swell and then shrink down to become a white dwarf, but that's all billions of years away.
Short answer Never. Nasas Parker solar probe would detect it being the closest object to the sun when NASA receives the news they legally have 72 hours to tell the state of defense then the senate Andy the president Donald J. trump will decide but they most likely will not tell us as knowing that hysteria would spread through the world and more damage would be caused then a immediate painless death.