views:

51

answers:

2

Hello friends

  1. My question is How can i calculate time duration between sunrise and sunset?
  2. Then how can i divide this duration(sunrise to sunset) into 8 equal parts(Hr: Min)?

All i need is starting and ending time of every part. And i want to write this code in VB.NET because in VB.NET i can easily design the GUI.

Thanks

A: 

You can use TimeSpan. Add the sunrise and sunset to it, and then use timespan.Seconds, timespan.Hours etc To devide it into 8 equal parts, just use timespan.Seconds / 8 and then calculate that into hours, minutes and seconds

If you don't already have the sunrise and sunset time, you can use this project to calculate it: http://www.codeproject.com/KB/cs/SunTime.aspx

Vidar Nordnes
+1  A: 

A quick search for "sunrise VB.NET" came up with a few results, such as this one.