解决方法
字符串格式的时间:
- post.created_at.strftime("FORMAT STRING HERE")
- # Without the influence of time-zone: I take it that you want UTC
- post.created_at.utc.strftime("FORMAT STRING HERE")
链接strftime文档:
http://ruby-doc.org/core/classes/Time.html#method-i-strftime
获取小时,分和秒值:
- post.created_at.hour
- post.created_at.min
- post.created_at.sec