Skip to content

Instantly share code, notes, and snippets.

@Arakaki-Yuji
Created September 17, 2019 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arakaki-Yuji/92c2ea1dbd2c39db6ec60d2f0484011d to your computer and use it in GitHub Desktop.
Save Arakaki-Yuji/92c2ea1dbd2c39db6ec60d2f0484011d to your computer and use it in GitHub Desktop.
今週月曜日の日付 ~ 今週日曜日の日付を出力する
# 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