A Sunrise and Sunset Time Calculator

Posted by Joe Yates Tue, 09 Mar 2010 09:14:00 GMT

I've released ruby-sun-times, which calculates sunrise and sunset times according to date and location.

Project and Installation

The project is hosted on GitHub

The gem is available from Gem Cutter

If you have a recent version of gem, you can install it with

$ gem install ruby-sun-times

Example

Here's how it works:

$ irb
>> require 'rubygems'
=> true
>> require 'sun_times'
=> true
>> SunTimes.set(Date.today, 44, 11).localtime
=> Tue Mar 09 18:14:08 +0100 2010

So, the sun will be setting round here at 6:14 PM local time.