LoginSignup
14

More than 5 years have passed since last update.

rubyで今日の日付をstringに変換する

Last updated at Posted at 2014-05-11

今日の日付を文字列として取得したい場合

Date.today.strftime("%Y-%m-%d")

%Yで4桁西暦、%mで0埋め2桁月、%dで0埋め2桁日

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
14