Created
September 17, 2019 01:29
-
-
Save Arakaki-Yuji/92c2ea1dbd2c39db6ec60d2f0484011d to your computer and use it in GitHub Desktop.
今週月曜日の日付 ~ 今週日曜日の日付を出力する
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
# coding: utf-8 | |
#!/bin/sh | |
exec ruby -x "$0" "$@" | |
#!ruby | |
require 'date'; | |
today = Date.today; | |
if(today.cwday == 1) then | |
this_week_monday = today; | |
else | |
this_week_monday = today - (today.cwday - 1) | |
end | |
if(today.cwday == 7) then | |
this_week_sunday = today | |
else | |
this_week_sunday = today + (7 - today.cwday) | |
end | |
print this_week_monday.strftime('%Y/%m/%d(月)') + '〜' + this_week_sunday.strftime('%Y/%m/%d(日)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment