October 2006
Intermediate to advanced
888 pages
16h 55m
English
You can obtain the canonical representation of the date and time by calling the asctime method (“ASCII time”); it has an alias called ctime, for those who already know it by that name.
You can obtain a similar result by calling the to_s method. This is the same as the result you would get if doing a simple puts of a date/time value.
The strftime method of class Time formats a date and time in almost any form you can think of. Other examples in this chapter have shown the use of the directives %a, %A, %U, %W, %H, %M, %S, %I, and %p; we list here all the remaining directives that strftime recognizes:
%b Abbreviated month name ("Jan") %B Full month name ("January") %c Preferred local date/time representation ...Read now
Unlock full access