Last active
July 10, 2024 15:22
-
-
Save hara-y-u/7c843aba2363aea4391d35931c6f6731 to your computer and use it in GitHub Desktop.
Ruby Script to find week index in month. / 日付がその月の第何週目かを調べるRuby Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you look at each month on calendar, you will notice 1-7days are on the first week and same for the rest. | |
# Therefore, the following formula holds. | |
# ISO8601 is not supported | |
(date.day - 1) / 7 + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment