Turning my lights off

An RTC module is the obvious answer - they're cheap, and there are plenty of examples showing how to use them. I think there are also some libraries which make it easy to schedule things to happen at specific times.

You could implement a solution which is far less accurate and far more complicated without using an RTC by measuring the interval between dawn and dusk and assuming that half way through this interval represents noon. You would probably want to average that answer out over quite a few days to get a stable answer unaffected by weather etc.