To illustrate the complexity of the issue, answer this deceptively simple question: How long is a day, here on Earth?
The midday-to-midday day length - the "mean solar day" - is defined as exactly 24.0000 hours. However, the rotation period of the earth, the "sidereal day" when observed from a point outside of the solar system, is 23 hours 56 minutes 4 seconds. What causes this slight discrepancy? The Earth has moved slightly in it's orbit over that 24 hour period, meaning the Sun has "moved" in the sky slightly - making the day slightly longer than it "should be" from an external point of view. Do the math, and that 3 hour 56 second difference is about 1/365th of a day. "365" being, of course, the length of the year.
So for Earth and planets like Earth, "the equation" is:
Length of day = rotation period / (1 - (rotation period / orbital period))
Note that all the time-units have to be the same; it doesn't really matter if you use "days" or hours" or "Martian sols", so long as they're all the same.
Things get complicated once a planet has a very slow "day" compared to the length of its "year", combined with a high orbital eccentricity. Mercury is a classic example of this. There are times when Mercury is moving around the Sun faster than it rotates. So the Sun doesn't just move serenely across the sky, like it does on Earth - it spirals, moving back and forth in a predictable yet chaotic-looking pattern; you'd need to know exactly where Mercury was in its orbit to be able to guess how fast the Sun was moving across the sky at any given moment.
As for "Does ED give you that information?", I'm afraid the answer is "yes, but it's hard to get at". Orbital periods and rotation periods in ED are given on the system map in "days" (i.e. Earth-24-hour-days), but they're rounded to the nearest tenth-of-a-day; a planet that rotates quickly will be stated to have a day length of "0.2 days" or even "0.1 days", whereas the actual rotation period might be 0.17693 days. So for fast-rotating planets, the reported rotation period simply isn't precise enough to give you a sensible result to the equation. I believe that more precise rotation periods are recorded in the journal when an Unexplored planet is scanned, but I don't think there's any way to get at the stats for an already-Explored planet.