Day and night cycles are one of the many subtle features that bring the world of Pokémon GO to life. When the game was first released, sunrise and sunset happened at the same local time every day, regardless of your location or the time of year. After an update in December 2016, sunrise and sunset began to reflect the time of year and location where you were playing.

It has long been hypothesized that sunrise and sunset times are queried from an external source such as AccuWeather. This hypothesis has become increasingly prevalent since the in-game weather feature was added and evidence began to accumulate that AccuWeather was being used as a source of weather data.

However, a cursory comparison between observed sunrise and sunset times against several databases reveals serious discrepancies, sometimes greater than 20 minutes. These discrepancies could not be explained by averaging over large areas or several days. Puzzled by this mystery, Silph researchers looked for an alternative explanation. We’re excited to share that the exact mechanics of sunrise and sunset have been solved!

Key Findings

Sunrise and sunset are calculated from an internal formula, not queried from a third-party source. The formula is approximate, not correcting for refraction or differences between observed and mean solar time.

The Formula

Solar Noon

Sunrise and sunset formulas often start with calculating solar noon. This is the time halfway between sunrise and sunset. The simplest possible formula for calculating solar noon in minutes at UTC is being used:

where longitude is in degrees from the Prime Meridian (positive to the east). This formula does not account for the “equation of time,” which is a correction for the difference between apparent and mean solar time. The equation of time has a total range of about 30 minutes throughout the year, and is the same for all locations. This is one of the primary reasons for the discrepancies between published sunrise/sunset tables and Pokémon GO.

Now we need to calculate the offset between solar noon and sunrise/sunset. There are two components to calculating the offset: the “declination angle” and the “hour angle.”

Declination Angle

First up is the declination angle, or the angle between a straight line connecting the centers of the Earth and Sun, and the equator. Again, simplicity is our friend:

where d is the number of days since January 1st, and declination angle is in degrees. The cosine function is cyclic, modeling the changes in the Earth’s tilt relative to the sun throughout the year. More accurate models will correct for the refraction of light as it passes through the Earth’s atmosphere.

Hour Angle

The hour angle is the last piece we need to calculate the offset of sunrise and sunset from solar noon. The hour angle is related to the declination angle and the latitude of your location by:

where ω is the hour angle and lat is the latitude of your location. If the hour angle is measured in degrees, sunrise and sunset times are simply:

These formulas give the sunrise and sunset in minutes at UTC.

Evaluation of Accuracy

By averaging the sunrise and sunset times observed in the game, we can validate the accuracy of the solar noon formula independently of the other two formulas. We recorded the exact sunrise and sunset in New Jersey, US; Kansas, US; and Ontario, Canada on six separate days in November. The largest discrepancy recorded was about 20 seconds.

Next, we compared the predictions of the full sunrise and sunset formula to the observed game sunrise (33 observations) and sunset (40 observations) in November and December in the following locations:

Australia

Chile

Canada

Germany

United Kingdom

United States (7 states)

The largest discrepancy between the observed and predicted time for all measurements was about 50 seconds. When observing sunrise and sunset in the same location on successive days, solar noon could vary by several seconds from day to day, indicating that there may be some delay in loading animations. This imprecision makes it difficult to determine if there is any internal rounding, or what spatial scale is being used.

While we are confident that this formula is general, it has not been tested in extreme locations close to the poles, or during the summer months. If you live close to one of the poles, we’d love to hear whether this formula holds up!

Parting Words

The practical implications of this discovery are limited. Known mechanics affected by day and night cycles are wild Pokémon spawns and the evolution of Eevee into Espeon or Umbreon. However, we hope that you enjoy taking a peek behind the curtain of the Pokémon GO world as much as we do.

Until next time, stay safe out there, travelers.

– Scientist Titleist