# Problem With Formatting

**URL:** <https://www.ruby-forum.com/t/problem-with-formatting/187716>\
**Category:** Ruby\
**Created:** [April 28, 2010, 7:35am UTC](https://www.ruby-forum.com/t/problem-with-formatting/187716 "2010-04-28T07:35:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![souravhaldar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@souravhaldar](https://www.ruby-forum.com/u/souravhaldar)\
**Post date:** [April 28, 2010, 7:35am UTC](https://www.ruby-forum.com/t/problem-with-formatting/187716/1 "2010-04-28T07:35:20Z")

</div>

The Below Code is not appropiate if some one explain

Day = 60 \* 60 \* 24

Fromat = “[http://www.google.com](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

---

<div class="post-metadata">

**Author:** ![souravhaldar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@souravhaldar](https://www.ruby-forum.com/u/souravhaldar)\
**Post date:** [April 28, 2010, 5:15pm UTC](https://www.ruby-forum.com/t/problem-with-formatting/187716/2 "2010-04-28T17:15:25Z")

</div>

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
```
