自分の環境にactive_support
があるか確認
$ gem which active_support
もし無い場合
$ gem install activesupport
か
$ vim Gemfile
gem 'activesupport' // 追記
$ bundle install
とてもシンプルなサンプルコード
#!/usr/bin/ruby
require 'active_support/time'
# require 'active_support/all' でも可
### 現在日時取得(Timeオブジェクト)
now = Time.now
p now
# => 2018-10-12 17:23:43 +0900
### 分解
p now.strftime("%Y-%m-%d")
# => "2018-10-12"
p now.strftime("%H:%M:%S")
# => "17:23:43"
p now.strftime("%z")
# => "+0900"
### 加減算
p (now - 1.second).strftime("%Y-%m-%dT%H:%M:%S")
# => "2018-10-12T17:23:42"
p (now + 1.minute).strftime("%Y-%m-%dT%H:%M:%S")
# => "2018-10-12T17:24:43"
p (now - 1.hour).strftime("%Y-%m-%dT%H:%M:%S")
# => "2018-10-12T16:23:43"
p (now + 1.day).strftime("%Y-%m-%dT%H:%M:%S")
# => "2018-10-13T17:23:43"
おわり