Ruby/Date/upto

Материал из Wiki.crossplatform.ru

Версия от 18:00, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

using the upto method, add the same amount of days back, showing the dates as you progress along

require "date"
date = Date.new( 2006, 11, 8 )
date.upto( date + 5 ) { |date| puts date }
date.to_s # => "2006-11-08"