TL;DR - How can I calculate the hours of sunlight a spot on a planet gets when I know its location, time of year, and altitude? How would having objects in the way affect these values?

I am currently writing a sci-fi short story where the people live in very tall cities, separated into 4 vertical areas. Being the geek I am, I want to make my story as scientifically accurate as possible using modern knowledge of physics. The city is supposed to be a dystopic version of Houston, but with more skyscrapers-like buildings. If the average height of these buildings were 50 stories and they were packed close together, how would that affect what parts of the buildings would get sunlight and for how long. I know this is a lot of generalized data, but I don't need exact time estimates either.

The idea I'm going for here is that there are two races - one human, one alien. The aliens have taken over earth to harvest its resources, but decided to keep humanity around so they pushed them into a few dozen megacities. Each megacity is composed of a lower, middle, and upper ring, with higher rings pertaining to wealthier individuals - getting more sunlight over a day. The aliens would then live on floating islands above the humanity rings, and being at a higher altitude than ground level, would get much more sunlight than usual (16-17 hours a day). Is this at all feasible?

  • $\begingroup$ This depends on what obstacles there are in the way - for instance, mountains, or valley walls. $\endgroup$
    Commented Nov 12, 2021 at 23:06
  • $\begingroup$ What is the difficulty that you are stuck with and, more importantly, what have you already tried and failed to (so that you now ask WB for help)? Most of the problem seems basic geometry with a bit of trigonometry involved, are you missing this type of knowledge from your geek baggage? $\endgroup$ Commented Nov 12, 2021 at 23:13
  • $\begingroup$ @KEY_ABRADE I'm talking about floating sky islands $\endgroup$ Commented Nov 12, 2021 at 23:28
  • $\begingroup$ @AdrianColomitchi I can't seem to find any data of how to calculate hours of sunlight based on altitude and position on the earth, and the rough numbers I can find for the sun's distance don't come up with accurate numbers when I crunch them (5.36 hours of sunlight...), and I have no idea how ambient light would affect things at sunrise/sunset times or light dispersion from the upper rings to the lowest one. It's not that important of a subject, and I thought a quick WB question wouldn't hurt anything. $\endgroup$ Commented Nov 12, 2021 at 23:31
  • 1
    $\begingroup$ @TheSquare-CubeLaw "day and night take the same time at any latitude" is a good approximation for "points stuck on the surface or about that". When you take into the consideration the span on non-trivial heights, the things will change. $\endgroup$ Commented Nov 12, 2021 at 23:41

3 Answers 3


Kind of a fun question. The problem is that it will depend a lot on the details. You could design your mega city badly and make it much worse by shadowing or design it some clever way and get sunlight to bounce around deeper in.

Sunrise and sunset will depend a little bit on the altitude but not a lot. Several hundred feet will get you a 3-5 minutes, several thousand feet 10-15 minutes.

The direction you face matters since we are above the equator. The south face of the city will get more sunlight. So the outer portion of the city will get more light.

In the middle of the city the spacing between the tall buildings would change the answer a lot. The bigger the spacing, the wider the range of angles where the light can reach the ground.

There are solar calculators, for solar energy where you can plug in latitude and longitude and get various parameters that could help you figure some of this out. Some take into account the refraction of the atmosphere etc. A cad program where you can move the light source around might let you visually see what the effects might look like.

  • $\begingroup$ The sunrise equation en.wikipedia.org/wiki/Sunrise_equation can be used to calculate hours of sunlight for a position and there is a correction for elevation that can be applied. $\endgroup$
    – UVphoton
    Commented Nov 13, 2021 at 0:10
  • $\begingroup$ At the cruising height of a commercial airliner (approx 30,000 feet), you get sunrise about 8 minutes before someone on the ground. "Several thousand feet" will not get you 15 minutes. The difference of several hundred feet will get you seconds, not minutes. $\endgroup$ Commented Nov 13, 2021 at 18:01
  • $\begingroup$ Yep, I didn’t bother to plug in numbers to check and was going off something I had seen about Mount Everest being about 15 minutes longer day, that’s about 30,000 ft which checks out with the 8 min for sunrise plus more for sunset. $\endgroup$
    – UVphoton
    Commented Nov 13, 2021 at 22:09

Additional information that may help:

Twilight - the Sun is not seen over the horizon, but the light from it is still reaching the surface of the planet due to the various processes of interaction between the atmosphere and the sunlight.

The practical definition of the twilight time varies on the specific purpose of that definition (and, with aliens in the equation, will vary from species to species). For the human species:

  • the astronomical twilight - Sun is 18 degrees behind the horizon - proper conditions (if the atmosphere is clear and still) to observe the faintest stars or nebulae - guaranteed no solar light will interfere.

  • the nautical twilight - Sun is 12 degrees behind the horizon. Unaided human eye cannot distinguish any sunlight at the horizon (that is to say, it becomes impossible to see a ship silhouette against the background of the horizon)

  • the civil twilight - Sun is 6 degree behind the horizon. Turn on your position lights folks, you cannot resolve the details (of another vehicle) against the most average backgrounds - without them it's too risky to drive or pilot.

In your setup, probably the "civil twilight" is what you're looking for.

Since we now have a proper definition of the problem (no longer "day/night duration"), we may use the search engines to look for "twilight online calculator". One of such entry is this one, which allows one to input the geographical location and the date and (picking the Without Moon data/ Sunrise/Sunset + Twilight (Civil, Nautical & Astronomical) in the mode) will output a table for the entire month.
For Huston, Texas on this very fine day of 2021/11/13, the page above tells that the civil twilight dusk starts at 06:19 and ends on 17:53 (time of day expressed in noon-based-local-hour, no daylight saving time considered).

In relation with the influence of altitude on the daylight duration, unless your buildings are close enough to the poles, the usual height for the buildings brings in a variation that negligible in human terms (unless you want event duration for which a couple of minutes makes all the difference).

At ecuator, a 50km height for the skyscraper at an Earth radius of 6379km will bring a maximum variation of the angle the Sun is no longer visible proportional with $atan(50/6379) = 0.0078 rad = 0.44908768^o$. Since the Earth takes 24h for a full $2\pi$ radians, the time difference between when the night falls at the base vs when it falls at the top is

$$\frac{atan(50/6379)}{2\pi}\cdot 24h\cdot 3600\frac{s}{h} = 107.78s$$

So a day at 50km altitude on Earth's ecuator is longer by about (give or take) 3 minutes.


Is it Earth?

For length of daylight at any given date at a location, you can use this calculator, among many others online.

For tightly packed buildings, hours of potential direct sunlight1 is purely a geometric problem: what percentage of the sky can a person see at a given location along the track of the sun. Multiply that percentage by the hours of daylight at that location. Done.

Calculating hours of sunlight based on altitude is fairly simple and can be crudely approximated. Ignoring refraction, which makes the hours of sunlight a bit longer since the light bends over the horizon, and the very slight non-roundness of the Earth which barely counts, you can use basic trigonometry to figure out how much further "around" the planet you can see based on altitude compared to someone on the ground. The sun moves across the sky at approximately 0.25 degrees per minute, so when you calculate how many more degrees around the planet your horizon is compared to someone on the ground, you know you have to add 4 minutes (on either side, so to sunrise and to sunset) for every degree.

According to this website, the basic rule of thumb is that for every 1.5 kilometers of altitude (on Earth), you gain 1 minute on each side, so the day becomes 2 minutes longer.

Assume someone is at the equator. Sunrise to sunset is 12 hours. To get it to 16 hours, you need (240 minutes / 2 minutes) * 1.5 km. In other words, your altitude would need to be, approximately, 180 kilometers.

So yeah, no buildings.

Looking at it another way, a 50 storey building is on average about 160 meters tall. Someone in the penthouse would, therefore, enjoy an awe-inspiring sunrise about 6.4 seconds before one of the plebs down on the street level.

  1. Note that there's still plenty of light at street level even in places like Manhattan, or in places with a lot of overhead cover like forests, even if the sun, or even the sky, isn't directly visible at a given location.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .