A sundial tells the time of day from the position of the shadow of its gnomon as cast by the sun. The gnomon is usually raised parallel to Earth’s axis of rotation, so its shadow will always fall to the same line despite the sun’s annual apparent motion.
Aligning the gnomon to the Earth’s axis of rotation allows the sundial to be accurate throughout the year. All of this happens because Earth is a rotating sphere orbiting the sun with a tilted axis.
Flat-Earthers incorrectly claim that sundial works because Earth is flat. In reality, sundials are designed with the knowledge Earth is a sphere. Real-world sundials cannot possibly work if Earth were flat. If Earth were flat, we would have constructed sundials in a very different design.