LoginSignup
0
0

More than 3 years have passed since last update.

Ruby Dateクラスの使い方2

Posted at

今日の日付のDateインスタンスを取得する

Dateクラスのインスタンスを作るためにDate.newを使ってきたが、Dateクラスでは、Date.todayとすることで、今日の日付のインスタンスを作ることができるようになっている。

date.rb
require "date"
date1 = Date.today
puts date1

結果

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