From: Siep Korteling Date: 2008-02-29T21:04:48+09:00 Subject: Re: Getting number of days in a month -- getting the number of weeks in a year. Rick Denatale wrote: > On 2/28/08, Serg Koren wrote: > (...) > a normal year starting on weekday 1 starts with 52 full weeks and ends > with a 'week' of 1 days a total of 53 'weeks.' > a leap year starting on weekday 1 starts with 52 full weeks and ends > with a 'week' of 2 days a total of 53 'weeks.' > (...) Following this analysis: require 'date' def numweeks(year) start_year = Date.civil(year,1,1) end_year = Date.civil(year,-1,-1) (start_year.strftime("%U") .. end_year.strftime("%U")).to_a.size end puts numweeks(2028) # =>54 regards, Siep -- Posted via http://www.ruby-forum.com/.