Sunset/Sunrise times

Forum regarding Windows Software and Home Automation Domotica.
Post Reply
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Digit »

Hi,

Does anybody know a good resource for calculating sunset/sunrise times ?

My ultimate goal is to have some kind of source that i can query periodically to fill my local SQL table with, or have some algorithm that can calculate those times for me.

I have found some websites that can calculate them for me, but typing them over is an option i am not willing to consider yet. ;-)
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Bwired »

Hi Digit
Here is some Visual Basic 6 code which calculates the Sunrise and sunset, it makes a table for the whole year. You have to program a bit for putting it in a SQL table. I have some other code as well but you have to run that daily so not attached.
Regards
Pieter
<b>Download Attachment:</b> [img]images/icon_paperclip.gif[/img] Sunrise_sunset.zip<br />7.03 KB

www.bwired.nl Online Domotica, Home Automation house.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Digit »

Hi Pieter,

Thanks for the VB code. However, after some more searching i found another source in Javascript that was easier to rewrite to Delphi (my favorite language) for me. It can calculate civil, nautical and astronomical sunrise/sunset times for any given location and date. It's almost finished now. If anyone is interested, just let me know.

Digit
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Bwired »

Hi Digit,
Yes please put it on the board!
I am a VB guy, but I can always learn from it and see how its done.
Do you have the java link as well?
Thanks
Pieter


www.bwired.nl Online Domotica, Home Automation house.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Digit »

Well, my Delphi code works but contains too much debugging code yet and needs some extra OO-related work to be done. I'll clean it up a bit and then i'll post it. This can take some days cause my time is a bit limited...

The source I used: http://www.meteonet.nl/diversen/zoncalc.htm

Digit
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Sunset/Sunrise times

Post by Digit »

Hi,

Sorry, no Domotica time for me in the last months..

Here's my contribution to calculating Sunrise/sunset calculations i mentioned in a previous post. It's written in Delphi, the code contains no comment, and i just added a little form today with a DateTimePicker to check the results a bit easier.

There's no Timezone/Daylight Saving correction yet, and you'll have to change latitude and longitude (see Unit1) to get the right results!

uploaded/Digit/2006826144438_zoncalc.zip
Post Reply

Return to “Windows Forum”