From: Glenn Jackman Date: 2010-04-29T00:15:06+09:00 Subject: Re: Problem With Formatting At 2010-04-28 01:35AM, "Sourav Haldar" wrote: > The Below Code is not appropiate if some one explain > > Day = 60 * 60 * 24 > > Fromat = "http://www.google.com" # or any Image Files > > t = Time.local(2005, 2, 5) > > MWF = [1,3,5] > > until t == Time.local(2007, 7, 9) > if MWF.include? t.wday > `wget #{t.strftime(Fromat)}` > sleep 3 > end > > t += Day > end You'll get into trouble with daylight savings time assuming that 1 day = 86400 seconds: t = Time.local(2009,11,1) # => 2009-11-01 00:00:00 -0500 day = 60*60*24 # => 86400 t + day # => 2009-11-01 23:00:00 -0500 To increment by 1 day, use the ActiveSupport gem: require 'active_support' t + 1.day # => 2009-11-02 00:00:00 -0500 -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous