Joe Yates' Blog

Programming and DevOps

A Sunrise and Sunset Time Calculator

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

The Project

The project is hosted on GitHub.

The gem is available from here.

Using ruby-sun-times

$ irb
>> require 'rubygems'
=> true
>> require 'sun_times'
=> true
>> SunTimes.set(, 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.