1.Time#strftime
2. time.strftime( string ) => string
3.
4. Formats _time_ according to the directives in the given format
5. string. Any text not listed as a directive will be passed through
6. to the output string.
7.
8. Format meaning:
9.
10. %a - The abbreviated weekday name ("Sun")
11. %A - The full weekday name ("Sunday")
12. %b - The abbreviated month name ("Jan")
13. %B - The full month name ("January")
14. %c - The preferred local data and time representation
15. %d - Day of the month (01..31)
16. %H - Hour of the day, 24-hour clock (00..23)
17. %I - Hour of the day, 12-hour clock (01..12)
18. %j - Day of the year (001..366)
19. %m - Month of the year (01..12)
20. %M - Minute of the hour (00..59)
21. %p - Meridian indicator ("AM" or "PM")
22. %S - Second of the minute (00..60)
23. %U - Week number of the current year, starting with the first Sunday as the first
24. day of the first week (00..53)
25. %W - Week number of the current year, starting with the first Monday as the first
26. day of the first week (00..53)
27. %w - Day of the week (Sunday is 0, 0..6)
28. %x - Preferred representation for the date alone, no time
29. %X - Preferred representation for the time alone, no date
30. %y - Year without a century (00..99)
31. %Y - Year with century
32. %Z - Time zone name
33. %% - Literal "%" character
34.
35. t = Time.now
36. t.strftime("Printed on %m/%d/%Y") #=> "Printed on 04/09/2003"
37. t.strftime("at %I:%M%p) #=> "at 08:56AM"
分享到:
相关推荐
rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails ...
[Pragmatic Bookshelf] Crafting Rails Applications Expert Practices for Everyday Rails Development (E-Book) ☆ 图书概要:☆ Rails 3 is a huge step forward. You can now easily extend the framework, ...
Ruby on Rails Guides v2 - Ruby on Rails 4.2.5
《Ruby on Rails Tutorial》中文版(原书第2版,涵盖 Rails 4) Ruby 是一门很美的计算机语言,其设计原则就是“让编程人员快乐”。David Heinemeier Hansson 就是看重了这一点,才在开发 Rails 框架时选择了 Ruby...
一个用Ruby on Rails搭建的图片分享的网站项目.完整源代码
《Rails之道》按照Rails的各个子系统进行组织编排,分别介绍了Rails的环境、初始过程、配置和日志记录,Rails的分配器、控制器、页面生成和路由,REST、资源和Rails,ActiveRecord的基础、关联、验证和高级技巧,...
3.1 版的 ruby on rails, 开发者必读,两种格式。
本资源是参照rails敏捷开发第四版书中的例子,rails的版本是rails3.2.6
Bootstrap 3 和 Rails 4(样例用的是Ruby 2.1.1,Rails 4.1.4) Table of Contents Preface 1 Chapter 1: Introducing Web Application Development in Rails 7 Why Bootstrap with Rails? 8 Setting up a Todo ...
adminlte-rails, AdminLTE Rails gem 将AdminLTE主题与 Rails 资产管道集成 AdminLTE Rails gem AdminLTE 是后端的高级 Bootstrap 主题。英镑 AdminLTE Rails gem 与 Rails 资产管道集成了英镑AdminLTE主题。安装将...
中文世界唯一一本Rails 4.0.0 + Ruby 2.0.0 的自學書籍
rails文档 rails api 英文
使用Aptana+Rails开发Rails Web应用 有Aptana的安装配置等等,中文
rails指南 中文版
Ruby on Rails helps you produce high-quality, beautiful-looking web applications quickly. You concentrate on creating the application, and Rails takes care of the details., Tens of thousands of ...
介绍rails框架,版本是rails2点几的,不过思路差不多,具体区别可以去看官网
Ruby+on+Rails+3+Tutorial.pdf 应用Rails进行敏捷Web开发第4版.pdf (Agile Web Development with Rails) Rails.Recipes.Rails.3.Edition.pdf
rails2-sample good book