Hello Everyone,(adsbygoogle = window.adsbygoogle || []).push({});

I am currently designing project where part of it will involve a website and amoungst things, on the site I would like present the time for sunrise and set for the current day and the same for moonrise and set as well as the current lunar phase. This is for a college project and I would prefer if someone could give me a formula/algorithm for any of them. I know there is code out there on the net but I can't just copy and paste this. I would feel comfortable writing the code to carry out any of the formulas you might have.

I think the formulas are probably quite difficult but would it not be true that the sunrise and sunset time will change by a fixed amount each day. for example if i know the sunrise time for my location on 1 august 2004 is it just a matter of adding on a certain amount of minutes and seconds each day until a certain date when the it will begin to rise earlier? this is probably a bit too good to be true?

Could the same apply for moonrise/set times?

Would the same type of method apply for the lunar phases? We know that the moon orbits earth every 29.6 days so is it just a matter of working out when the last full moon was, lets say it was 1 august we now know that next one will be 29.6 days later. so if someone comes along on august 15 the program could then work out the percentage of the moon showing and give a good estimate of the phase. similarily if someone comes along in december then the program could start from 1 august and then calculate the phase and % for that day. Does anybody think this would work or is there an accurate formula out there?

Also does anybody know when darkness officailly starts? how long after sunset? same for twilight, dawn etc?

Thanks for any help anybody might have.

PS i hope I posted this on the correct forum. If you think it is better suited to one of the maths forum please say.

Thanks again

goats

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Formula for sunset/rise times, moonrise/set and phases

**Physics Forums | Science Articles, Homework Help, Discussion**