LoginSignup
13
8

More than 5 years have passed since last update.

Ruby で 現在日時の 14 桁の文字列を生成する

Posted at

ファイル名に使ったりするために現在日時の 14 桁の数値を生成する方法です。

require 'date'
p DateTime.now.strftime('%Y%m%d%H%M%S')

以下は出力結果です。

"20140522004609"
13
8
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
13
8