LoginSignup
11
11

More than 5 years have passed since last update.

入門: 祝日を取得してみた

Last updated at Posted at 2014-09-02

gem holidays

公式ページ

gemインストール
gem install holidays
holidaysのHomePage情報
gem list holidays -d

もしくは

gem serverでwebページでのマニュアル閲覧
$ gem server
Server started at http://0.0.0.0:8808
irb
require 'holidays'
date = Date.civil(2014,9,15)
date.holiday?(:jp)
Holidays.on(date, :jp)
一年間の祝日一覧を取得
require 'holidays'
from = Date.civil(2014,1,1)
to = Date.civil(2014,12,31)
Holidays.between(from, to, :jp)

Dateクラス

Dateクラス使い方
t = Date.today()
p t
p t.next_month(12) # 一年後
p t.next_day(13)
p t.cweek
p t.tuesday?
p t.wednesday?

Dateクラスについて目を通したページ:

11
11
1

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
11
11