Created
November 15, 2021 17:44
-
-
Save 6david9/66b09a17a02c5259a754ee2369affb2e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require "date" | |
class Date | |
def weekday | |
case self.wday | |
when 0 then "日" | |
when 1 then "一" | |
when 2 then "二" | |
when 3 then "三" | |
when 4 then "四" | |
when 5 then "五" | |
when 6 then "六" | |
end | |
end | |
end | |
now = Date.today | |
monday = now - (now.wday - 1) % 7 | |
7.times do |n| | |
day = monday + n | |
puts "(#{day.weekday}) #{day.mon}-#{day.mday}" | |
end |
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
#!/usr/bin/env ruby | |
require "date" | |
class Date | |
def weekday | |
case self.wday | |
when 0 then "日" | |
when 1 then "一" | |
when 2 then "二" | |
when 3 then "三" | |
when 4 then "四" | |
when 5 then "五" | |
when 6 then "六" | |
end | |
end | |
end | |
now = Date.today | |
monday = now - (now.wday - 1) % 7 | |
5.times do |n| | |
day = monday + n | |
puts "(#{day.weekday}) #{day.mon}-#{day.mday}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment