简单类型 / 日期和时间

require 'date'

now = DateTime.now
shortStyleEn = now.strftime("%m/%d/%y %H:%M %p")
# shortStyleEn is "06/05/17 11:45 AM"

shortStyleRu = now.strftime("%d.%m.%y %H:%M")
# shortStyleRu is "19.01.22 10:19"

customStyle = now.strftime("%Y-%m-%d")
# customStyle  is "2017-06-05"

standartStyle = now.to_s
# customStyle  is "2017-06-05 11:45:22.058697"

puts "shortStyleEn is '#{shortStyleEn}'"
puts "shortStyleRu is '#{shortStyleRu}'"
puts "customStyle is '#{customStyle}'"
puts "standartStyle is '#{standartStyle}'"