Twilight on Earth is the illumination of the lower atmosphere when the Sun is not directly visible because it is below the horizon. Twilight is produced by sunlight scattering in the upper atmosphere, illuminating the lower atmosphere so that Earth's surface is neither completely lit nor completely dark. The word twilight is also used to denote the periods of time when this illumination occurs.
since this is a pure mathematical calculation, there is no benefit of calling external web service api
API for sunrise, sunset, moonrise and moonset timing @ip geolocation