Last active
January 24, 2017 03:29
-
-
Save takoikatakotako/897b987dbe942accc51bafde0cfcc15b to your computer and use it in GitHub Desktop.
ニクサーチ、次の29(肉)の日を探します。
This file contains hidden or 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
| require 'date' | |
| #次の29(肉)の日を検索 | |
| def niku_search() | |
| now = Date.today | |
| nx_29 = now | |
| if now.day==29 then | |
| puts('今日は29の日ですモー') | |
| return | |
| elsif now.day<29 then | |
| nx_29+=(29-now.day) | |
| else | |
| y=now.year.to_i | |
| m=now.month.to_i | |
| if m==12 | |
| #年末 | |
| y++ | |
| m=1 | |
| elsif now.leap? && m==1 | |
| #閏年 | |
| m=2 | |
| elsif m==1 | |
| #not閏年 | |
| m=3 | |
| else | |
| #次の月 | |
| m=m+1 | |
| end | |
| nx_29=Date.new(y,m,29) | |
| end | |
| puts ('次の29の日は' + nx_29.strftime('%Y/%-m/%-d ') + 'ですモー') | |
| end | |
| niku_search() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment