Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active October 20, 2015 12:11
Show Gist options
  • Save YumaInaura/afb178bb33c3848e6ad8 to your computer and use it in GitHub Desktop.
Save YumaInaura/afb178bb33c3848e6ad8 to your computer and use it in GitHub Desktop.
Rails: Date / Time / DateTime 型の違い。そしてSQL用の文字列を得る方法。 ref: http://qiita.com/Yinaura/items/9c0cbb7c5d9e0440b111
Date.today
# => Tue, 20 Oct 201
Time.now
# => 2015-10-20 19:22:41 +0900
DateTime.now
# => Tue, 20 Oct 2015 19:22:43 +0900
Date.today.to_s
Time.now.to_s(:db)
DateTime.now.to_s(:db)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment