MonthDate
month_date is a ruby gem to help you get the date more easily.
Usage
get dates in specific week
MonthDate.week_date_in_month(year, month, week)
Example
MonthDate.week_date_in_month(2014, 1, 1) # get all Monday dates in 2014/1
=> ["20140106", "20140113", "20140120", "20140127"]
get dates in range
MonthDate.dates_in_range(start_date, end_date)
Example
MonthDate.dates_in_range("20141230", "20150102")
parameter
week
| 0 | Sunday |
|---|---|
| 1 | Monday |
| 2 | Tuesday |
| 3 | Wednesday |
| 4 | Thursday |
| 5 | Friday |
| 6 | Saturday |
Installation
Add this line to your application's Gemfile:
gem 'month_date'
And then execute:
$ bundle
Or install it yourself as:
$ gem install month_date
Parameter
week
0~6 means Sunday ~ Saturday