I am making a hypothetical solar system with random masses and distances (but still physically and mathematically accurate). I want to calculate the trajectory of a spacecraft, and to do that, I need to know the orbital period. I want to know what the orbital period for half the elliptical orbit is. From perigee to apogee.

According to Kepler's Third Law, $$T = 2\pi\sqrt{a^3\over \mu}$$

Where $T$ equals the Orbital Period, $a$ is the semi-major axis and $\mu$ is the Sun's GM.

In this imaginary solar system case, $\mu =$ $2.4 \times 10^{20}$ and $a =$ $2.0 \times 10^{11}$ metres. This gives a period of 36,275,987.3 seconds. Which gives an orbital period of 18,137,993 seconds for half the orbit.

However, according to this Physics Stack Exchange answer on how to find the transit time for a specific portion of an orbit, gives the formula: $$\tau = \frac{T}{2\pi} \bigg ( E_1 – E_2 – e (\sin E_1 – \sin E_2) \bigg)$$ Where $\tau$ is the transit time, $e$ eccentricity (0.44). Finally, $E_1$ & $E_2$ is the eccentric anomaly of two points. Since I want to find the portion from perigee to apogee, my Eccentric Anomaly is 0 and 180 degrees respectively. I confirmed these two angles with this formula from this source: $$\cos E = \frac{\cos v + e}{1 + e\cos v}$$ Where $v$ = true anomaly, and $e$ = eccentricity (in this case $e= 0.44$). True anomaly is 0 degrees at perigee, and 180 degrees at apogee.

Here is the equation when substituting the values (value of $e$ doesn't really matter because $\sin0^o$ and $\sin180^o$ = 0): $$\tau = \frac{36275987.3}{2\pi}\bigg(0^o-180^o-0.44(\sin0^o – \sin180^o)\bigg)$$ This formula gives the result $-1,039,230,849$ seconds (I guess a little mini side question: Why and should it be negative?).

**Question:** Why am I getting two different results for the same portion of the orbit; perigee to apogee? Using the first formula, I got $18,173,993$ seconds (about 6 months), but for the second Equation, I got $1,039,230,849$ seconds (about 33 years!). Judging by the results, the former seems correct to me, 6 months. What am I doing wrong with the second equation?