Learn how to use the trusty strftime method to format a time, and see how Rails allows you to save this format for later use.
# config/environment.rb
Time::DATE_FORMATS[:due_time] = "due on %B %d at %I:%M %p"
<%= task.due_at.to_s(:due_time) %>
使用strftime格式化时间
本文介绍如何利用strftime方法来格式化时间,并展示了Rails框架中保存和复用时间格式的具体应用实例。
576

被折叠的 条评论
为什么被折叠?



