Skip to content

Instantly share code, notes, and snippets.

@mistyrinth
Created December 1, 2018 12:02
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 mistyrinth/bf890f087e2cd56f3f048de8c6430b06 to your computer and use it in GitHub Desktop.
Save mistyrinth/bf890f087e2cd56f3f048de8c6430b06 to your computer and use it in GitHub Desktop.
# Timeオブジェクトを配列として取得
time = Time.now
aryTime = time.to_a
p aryTime
# 起算時からの経過秒数を取得
pasttime = time.to_f
p pasttime
# タイムゾーンと協定世界時の時差を取得
timedifs = time.utc_offset
puts "時差は#{timedifs}秒です"
timedifh = timedifs / 60 / 60
puts "時間に直すと#{timedifh}時間です"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment