Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
今週月曜日の日付 ~ 今週日曜日の日付を出力する
# 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
You can’t perform that action at this time.