LoginSignup
0
0

More than 3 years have passed since last update.

Rubyの日付を扱うクラス

Posted at

※初学者によるアウトプットのため正確性にかけるかもしれません。
 ご注意ください。

日付を扱うためには、Dateクラスを使用します。requireを使って読み込むことで、自分でクラスを定義しなくても使うことが可能です。

Dateクラスは、Date.newでインスタンスを作れます。インスタンスを出力すると、日付を表示できます。下の例以外でも色々な日付インスタンスメソッドがあります。

例えばこんな感じですね。
require "date"

 〇〇 = Date.today

puts 〇〇

上のものは今日の日付のインスタンスを出力しています。

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