Sandstone is a sedimentary rock. Sedimentary rocks form from sediments that deposited by the wind and water. Over the time those sediments will get pressed and cemented together. It can take millions of years for sediments to become a rock. So the oldest layers of a sandstone are on a bottom.