Rails date Flashcards
1
Q
How to get a date which was several days ago?
A
21.days.ago
2
Q
How to get a date which will be through several days in the future?
A
21.days.from_now
3
Q
How to get the end of month?
A
Date.current.end_of_month
4
Q
How to get start of month?
A
Date.current.beginning_of_month
5
Q
How to get value since days after a specific day?
A
Date.parse('15 Nov 2019').days_since(10) #=> Mon, 25 Nov 2019