I've two datestamps:
18 Nov 2013
21 Nov 2013
How can I take the day's between these two datestamps?
The final result should look like:
Monday Tuesday Wednesday Thursday
Edit:
Thanks @Alok Swain
now i want to print the days on the page... but it prints me the array out without giving him the command to do that :/
output:
["Monday", "Tuesday", "Wednesday", "Thursday" ]
and when i make a foreach loop it prints me only the days (that is what i want)
but with the array, too :D
output:
Monday
Tuesday
Wednesday
Thursday
["Monday", "Tuesday", "Wednesday", "Thursday" ]
EDIT
Resovled: I had in the view:
<%= @foo.each do |f| %>
instead:
<% @foo.each do |f|%>
How about this
start_day = Time.parse("18 Nov 2013").wday # gives 1 (Monday)
end_day = Time.parse("21 Nov 2013").wday # gives 4 (Thursday)
days_arr = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
days = []
for i in start_day..end_day
days << days_arr[i]
end