Of course this wouldn't work in space, if anything due to the lack of oxygen but also for many different reasons, but bear with me here.
In its current form the Sun is estimated to be able to power itself for roughly 10 billion years (more on that later), how long could the Sun burn before using up all its fuel if it was a coal burning plant?
Fusion powered Sun
As it is now, the Sun is getting its energy from the fusion of 4 hydrogen atoms into one helium atom
The 4 protons in the hydrogen atoms fusion to create the helium atom with 2 protons and 2 neutrons. This process creates a lot of energy and it is this process which is keeping the Sun hot and shiny.
The diagram below shows the process of converting the hydrogen into helium inside the Sun..
Note: The atoms in the core of the Sun have their electrons stripped off, so it is really the nuclei of the atoms.
Picture from cse.ssl.berkeley.edu
Mass of 1 Hydrogen atom: 1.673 x 10-24 grams Mass of 1 Helium atom: 6.644 x 10-24 grams
The difference in mass between the Helium atom and the 4 hydrogen atoms is about 0.7% (i.e. the Helium atom has a mass which is 0.7% less than the 4 hydrogen atoms combined) .
That mass is the energy released in the fusion. It isn't "lost" it has just been converted into energy according to the famous E = mc2 equation.
The Sun is releasing roughly 3.8 * 1026 Watts (or Joule/Second) of energy and all this energy has to come from the fusion reaction mentioned above.
Using E = mc2 we get that the amount of mass converted into energy every second is about 4.228 million tons or 4.228 billion kilograms [calculation at the bottom of the post].
With only 0.722 % of the mass being converted into energy this means that around 586 million tons of hydrogen must be converted into helium every single second !
Millions of tons of pure energy.
The total mass of the Sun is about 2 x 1030 kg.
The core of the Sun is about 10% of the total mass and the core is the only part of the Sun available for nuclear fusion. The mass of the available nuclear fuel is therefore 2 x 1029 kg.
At 586 million tons per second the Sun has fuel for more than 10 billion years! (which also means that at about 4.5 billion years old it is only halfway in its life cycle).
So the fusion powered sun can shine for more than 10 billion years.
Life-cycle of the Sun. Picture from www.ifa.hawaii.edu.
Coal powered Sun
Lets see what a coal powered Sun can do.
Converting chemical energy is a LOT less efficient than using nuclear energy (such as fusion). Because of this, burning 1 kg of regular brown coal only releases about 25 MJ of energy, higher grades of coal can raise this amount to around 35 MJ/kg.
I'll use the higher figure in the calculations to give coal an edge.
Coal per second
The energy released by the Sun is still 3.8 * 1026 Joule/second.
At 35 MJ/kg (or 3.5 * 107 Joule) we'll need to burn 1.09 * 1019 kg of coal every second to keep up.
So how much coal is that? Well, the Earth has a mass of 5.9736×1024 kg so at 1.09 * 1019 kg / second, an Earth-massed ball of coal would only last 548.000 seconds or about 6.34 days. That's one Earth-mass of coal every week required to power the Sun!
The mass of the Sun is still at 2 x 1030 kg.
This only gives us enough fuel for 1.84 * 1011 seconds or 5837.3 years.
A coal-powered Sun would only last from the time the great pyramid of Giza was built and until about a thousand years from today.
A fusion powered Sun lasts from 5 billion years ago and 5 billion years into the future.
How fortunate for us that our Sun chose nuclear power and not coal ;-)
Below this line you'll find the boring math. If you find an error please let me know in the comments.