Reputation: 397
I have the lat and long of a location and want to know whether it is day or night in that location or at least know the time there.
Is there a way to do this without using web services?
Upvotes: 0
Views: 135
Reputation: 6806
There is an explanation of how to calculate the time of sunrise and sunset at http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
That produces a result in UTC. The phone knows the current time in UTC. So you can then work out whether the sun has set, and how long ago, at the location you want.
Upvotes: 3