Problem With Formatting

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

At 2010-04-28 01:35AM, “Sourav H.” wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs