Why this ruby code is not working

Why the value of temp2 is not consistent with the value of temp.

Loading development environment.

list = []

=> []

 (1..10).to_a.each do |i|

?> start_time_temp = i.days.ago.beginning_of_day

  puts start_time_temp
  temp2 = start_time_temp.strftime("%m-%B-%Y")
  puts temp2
end

Fri Feb 02 00:00:00 -0500 2007
02-February-2007

Thu Feb 01 00:00:00 -0500 2007
02-February-2007

Wed Jan 31 00:00:00 -0500 2007
01-January-2007

Tue Jan 30 00:00:00 -0500 2007
01-January-2007

Mon Jan 29 00:00:00 -0500 2007
01-January-2007

Sun Jan 28 00:00:00 -0500 2007
01-January-2007
Sat Jan 27 00:00:00 -0500 2007
01-January-2007
Fri Jan 26 00:00:00 -0500 2007
01-January-2007
Thu Jan 25 00:00:00 -0500 2007
01-January-2007
Wed Jan 24 00:00:00 -0500 2007
01-January-2007
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Never mind. I just need some coffee.

Sorry for the trouble.

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