Methodology
How the numbers on this site are computed, and where the data comes from.
Time zones
All time-zone data comes from the IANA Time Zone Database via your browser's Intl.DateTimeFormat API. This means times reflect the most recent rules your operating system has installed — when a country changes its DST rules, the database is updated, OS vendors push the update, and our times stay current automatically.
Each city is assigned an IANA zone identifier (such as Asia/Karachi) by hand, based on the political authority that sets clock rules for that city.
Sunrise and sunset
We use the standard NOAA solar position algorithm, derived from Jean Meeus's Astronomical Algorithms (1991). The algorithm computes the sun's position in the sky as a function of date, latitude, and longitude, then solves for the moment its centre is at altitude −0.833° (which corresponds to the upper edge crossing the apparent horizon, accounting for atmospheric refraction).
Civil twilight is computed at altitude −6°. Day length is the interval from sunrise to sunset, expressed in hours and minutes.
For most latitudes our results agree with the US Naval Observatory's published tables to within about a minute. At extreme latitudes during polar day or polar night, sunrise and sunset are mathematically undefined and our pages will display "—".
Distances
City-to-city distances use the haversine formula on a spherical Earth (radius 6,371 km). This is accurate to about 0.5% for any pair of points; for a more accurate result on a precise WGS-84 ellipsoid you'd use Vincenty's formulae, but for "is this flight long?" purposes the haversine answer is close enough that it's not worth the extra complexity.
City coordinates and population
Coordinates and population figures come from the GeoNames database (cities5000 and cities15000 datasets), supplemented by the CIA World Factbook for capital cities and small island nations. Populations are metropolitan-area estimates where available; otherwise city-proper figures.
What we do not compute
We do not currently provide moonrise/moonset, planetary positions, weather, or air quality data. These are on the roadmap.