ruby on rails - How to get all 'specific days' within a date range -


how can let's dates saturday , sunday x year y year , store them array? pseudo code be

(year_today..next_year).get_all_dates_for_saturday_and_sunday 

or perhaps there gems cater already?

try this:

(date.today..date.today.next_year).select { |date|   date.sunday? or date.saturday? }  #=> [sat, 03 sep 2016,sun, 04 sep 2016,sat, 10 sep 2016,sun, 11 sep 2016... 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -