convert_energy

Convert an energy value from one unit to another.

Syntax

convert_energy(value,from,to)

Learn more about syntax conventions.

Parameters

Name Type Required Description
value real ✔️ The value to be converted.
from string ✔️ The unit to convert from. For possible values, see Conversion units.
to string ✔️ The unit to convert to. For possible values, see Conversion units.

Conversion units

  • BritishThermalUnit
  • Calorie
  • DecathermEc
  • DecathermImperial
  • DecathermUs
  • ElectronVolt
  • Erg
  • FootPound
  • GigabritishThermalUnit
  • GigaelectronVolt
  • Gigajoule
  • GigawattDay
  • GigawattHour
  • HorsepowerHour
  • Joule
  • KilobritishThermalUnit
  • Kilocalorie
  • KiloelectronVolt
  • Kilojoule
  • KilowattDay
  • KilowattHour
  • MegabritishThermalUnit
  • Megacalorie
  • MegaelectronVolt
  • Megajoule
  • MegawattDay
  • MegawattHour
  • Millijoule
  • TeraelectronVolt
  • TerawattDay
  • TerawattHour
  • ThermEc
  • ThermImperial
  • ThermUs
  • WattDay
  • WattHour

Returns

Returns the input value converted from one energy unit to another. Invalid units return null.

Example

print result = convert_energy(1.2, 'Joule', 'BritishThermalUnit')

Output

result
0.00113738054437598