railsで今日の日付を2019年3月28日のように年月日で変数に入れたいです。
以下では「no implicit conversion of Date into String」とエラーが出ました。
どのようにすれば、今日の日付を年月日で変数に入れることが出来ますでしょうか?
よろしくお願いします。
実行環境
ruby 2.5
rails 5.2.2
@today =DateTime.strptime(Date.today, '%Y年%m月%d日').to_time.to_s
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/01 04:04