LoginSignup
4
5

More than 5 years have passed since last update.

今年の祝日を取得する

Last updated at Posted at 2015-08-11

更新

振替休日も取れるのでこっちのがいいですね

祝日をWebAPIから取得するシェルスクリプトをワンライナーで


皆さんはお盆に入りましたか?
自分は今日からお休みです。
月曜からまた仕事だと鬱で吊りたくなりますね。
次の祝日を知っておくと少しは頑張れる気がします。

Perl 祝日名の取得 - とみぞーノート

$ cpanm Calendar::Japanese::Holiday
holiday.pl
use strict;
use warnings;
use Calendar::Japanese::Holiday;
use utf8;
use open qw(:encoding(utf8) :std);

my $year = 2015;
foreach my $month (1..12) {
  my $href = getHolidays($year, $month, 1);
  foreach my $day (sort keys %$href) {
    printf("%02d/%02d %s\n", $month, $day, $href->{$day});
  }
}
$ perl holiday.pl
01/01 元日
01/12 成人の日
02/11 建国記念の日
03/21 春分の日
04/29 昭和の日
05/03 憲法記念日
05/04 みどりの日
05/05 こどもの日
05/06 振替
07/20 海の日
09/21 敬老の日
09/22 国民の休日
09/23 秋分の日
10/12 体育の日
11/23 勤労感謝の日
11/03 文化の日
12/23 天皇誕生日

$ perl holiday_2016.pl
01/01 元日
01/11 成人の日
02/11 建国記念の日
03/20 春分の日
03/21 振替
04/29 昭和の日
05/03 憲法記念日
05/04 みどりの日
05/05 こどもの日
07/18 海の日
08/11 山の日
09/19 敬老の日
09/22 秋分の日
10/10 体育の日
11/23 勤労感謝の日
11/03 文化の日
12/23 天皇誕生日

次のシルバーウィークまで頑張りましょう(´Д`)
ちなみに来年から山の日が追加らしいですね。

山の日 - Wikipedia

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5