Elm

Other Elm solutions.
module SpaceAge exposing (Planet(..), ageOn)


type Planet
    = Mercury
    | Venus
    | Earth
    | Mars
    | Jupiter
    | Saturn
    | Uranus
    | Neptune


orbitalPeriod : Planet -> Float
orbitalPeriod planet =
    case planet of
        Mercury ->
            0.2408467

        Venus ->
            0.61519726

        Earth ->
            1.0

        Mars ->
            1.8808158

        Jupiter ->
            11.862615

        Saturn ->
            29.447498

        Uranus ->
            84.016846

        Neptune ->
            164.79132


earthYearInSeconds : Float
earthYearInSeconds =
    31557600


ageOn : Planet -> Float -> Float
ageOn planet seconds =
    seconds
        / (orbitalPeriod planet
            * earthYearInSeconds
          )

Haskell

Other Haskell solutions.
module SpaceAge
  ( Planet(..)
  , ageOn
  ) where

data Planet
  = Mercury
  | Venus
  | Earth
  | Mars
  | Jupiter
  | Saturn
  | Uranus
  | Neptune

earthAgeSeconds :: Float
earthAgeSeconds = 31557600

relativeOrbit :: Planet -> Float
relativeOrbit planet =
  case planet of
    Mercury -> 0.2408467
    Venus   -> 0.61519726
    Earth   -> 1.0
    Mars    -> 1.8808158
    Jupiter -> 11.862615
    Saturn  -> 29.447498
    Uranus  -> 84.016846
    Neptune -> 164.79132

ageOn :: Planet -> Float -> Float
ageOn planet seconds = seconds / earthAgeSeconds / relativeOrbit planet

Roc

Other Roc solutions.
module [age]

Planet : [
    Mercury,
    Venus,
    Earth,
    Mars,
    Jupiter,
    Saturn,
    Uranus,
    Neptune,
]

earthYearSeconds = 31_557_600

age : Planet, Dec -> Dec
age = \planet, seconds ->
    earthYears = seconds / earthYearSeconds
    earthYears / orbitalPeriod planet

orbitalPeriod = \planet ->
    when planet is
        Mercury -> 0.2408467
        Venus -> 0.61519726
        Earth -> 1.0
        Mars -> 1.8808158
        Jupiter -> 11.862615
        Saturn -> 29.447498
        Uranus -> 84.016846
        Neptune -> 164.79132