I was writing some code to find out what the daylight hours were. Thanks to www.earthtools.org I was able to do this quite easily using their webservice.
Here is the code that I came up with, you pass in latitude and longditude plus the day and the month to get an answer. It works like this:
static void Main(string args)
sunReader reader = new sunReader();
sun data = reader.getDaylightInfo(52.1992, 0.1274,
Console.WriteLine("Cambridge Dawn: " + data.Dawn);
Console.WriteLine("Cambridge Dusk: " + data.Dusk);
I have tried to follow the restrictions from earthtools.org, so this example has some very basic caching (saving results to disk). But it seems to work good enough for the hobbyist type stuff I'm using it for...