From: Joe Petrini Date: 2007-09-20T01:00:00+09:00 Subject: Re: How to compute Sunrise / Sunset ? Ken Bloom wrote: > On Wed, 19 Sep 2007 22:23:47 +0900, Joe Joe wrote: > >> I need to compute sunrise/set times in ruby for a given long lat. Does >> anyone know any way to do this? Are there any modules or helper classes >> out there?? >> >> thanks! > > I have previously posted code for this at > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/264573 I just came across that and had a little trouble getting it working but realized I was passing a datetime instead of a Date. For anyone else interested put the code above in a file sunrise.rb: require 'Sunrise' include Sunrise #Create the location loc = Sunrise::Location.new(39.2,-75.1) Create the date d = Date.new(2007,9,19) sunrisetime = sunrise(d,p) Thanks for the code, it's a lifesaver!! -- Posted via http://www.ruby-forum.com/.