U:RDoc::AnyMethod[iI" strftime:ETI"Date#strftime;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"BFormats date according to the directives in the given format ;TI" string. ;TI"8The directives begin with a percent (%) character. ;TI"FAny text not listed as a directive will be passed through to the ;TI"output string.;To:RDoc::Markup::BlankLineo; ; [ I"6A directive consists of a percent (%) character, ;TI":zero or more flags, an optional minimum field width, ;TI"6an optional modifier, and a conversion specifier ;TI"as follows.;T@o:RDoc::Markup::Verbatim; [I"+% ;T: @format0o; ; [I" Flags:;To; ; [ I"&- don't pad a numerical output. ;TI" _ use spaces for padding. ;TI"0 use zeros for padding. ;TI""^ upcase the result string. ;TI"# change case. ;T; 0o; ; [I"9The minimum field width specifies the minimum width.;T@o; ; [I"6The modifiers are "E", "O", ":", "::" and ":::". ;TI"="E" and "O" are ignored. No effect to result currently.;T@o; ; [I"Format directives:;T@o; ; [_I"Date (Year, Month, Day): ;TI"C %Y - Year with century (can be negative, 4 digits at least) ;TI"4 -0001, 0000, 1995, 2009, 14292, etc. ;TI"1 %C - year / 100 (round down. 20 in 2009) ;TI" %y - year % 100 (00..99) ;TI" ;TI"4 %m - Month of the year, zero-padded (01..12) ;TI"* %_m blank-padded ( 1..12) ;TI"& %-m no-padded (1..12) ;TI". %B - The full month name (``January'') ;TI"- %^B uppercased (``JANUARY'') ;TI"1 %b - The abbreviated month name (``Jan'') ;TI") %^b uppercased (``JAN'') ;TI" %h - Equivalent to %b ;TI" ;TI"3 %d - Day of the month, zero-padded (01..31) ;TI"& %-d no-padded (1..31) ;TI"4 %e - Day of the month, blank-padded ( 1..31) ;TI" ;TI"' %j - Day of the year (001..366) ;TI" ;TI"-Time (Hour, Minute, Second, Subsecond): ;TI"A %H - Hour of the day, 24-hour clock, zero-padded (00..23) ;TI"B %k - Hour of the day, 24-hour clock, blank-padded ( 0..23) ;TI"A %I - Hour of the day, 12-hour clock, zero-padded (01..12) ;TI"B %l - Hour of the day, 12-hour clock, blank-padded ( 1..12) ;TI"= %P - Meridian indicator, lowercase (``am'' or ``pm'') ;TI"= %p - Meridian indicator, uppercase (``AM'' or ``PM'') ;TI" ;TI"( %M - Minute of the hour (00..59) ;TI" ;TI"* %S - Second of the minute (00..59) ;TI" ;TI"1 %L - Millisecond of the second (000..999) ;TI"H %N - Fractional seconds digits, default is 9 digits (nanosecond) ;TI"J %3N millisecond (3 digits) %15N femtosecond (15 digits) ;TI"J %6N microsecond (6 digits) %18N attosecond (18 digits) ;TI"J %9N nanosecond (9 digits) %21N zeptosecond (21 digits) ;TI"J %12N picosecond (12 digits) %24N yoctosecond (24 digits) ;TI" ;TI"Time zone: ;TI"F %z - Time zone as hour and minute offset from UTC (e.g. +0900) ;TI"P %:z - hour and minute offset from UTC with a colon (e.g. +09:00) ;TI"O %::z - hour, minute and second offset from UTC (e.g. +09:00:00) ;TI"? %:::z - hour, minute and second offset from UTC ;TI"O (e.g. +09, +09:30, +09:30:30) ;TI", %Z - Equivalent to %:z (e.g. +09:00) ;TI" ;TI"Weekday: ;TI"/ %A - The full weekday name (``Sunday'') ;TI", %^A uppercased (``SUNDAY'') ;TI"+ %a - The abbreviated name (``Sun'') ;TI") %^a uppercased (``SUN'') ;TI"0 %u - Day of the week (Monday is 1, 1..7) ;TI"0 %w - Day of the week (Sunday is 0, 0..6) ;TI" ;TI"/ISO 8601 week-based year and week number: ;TI"FThe week 1 of YYYY starts with a Monday and includes YYYY-01-04. ;TI"HThe days in the year before the first week are in the last week of ;TI"the previous year. ;TI" %G - The week-based year ;TI"> %g - The last 2 digits of the week-based year (00..99) ;TI"8 %V - Week number of the week-based year (01..53) ;TI" ;TI"Week number: ;TI"HThe week 1 of YYYY starts with a Sunday or Monday (according to %U ;TI"Hor %W). The days in the year before the first week are in week 0. ;TI"M %U - Week number of the year. The week starts with Sunday. (00..53) ;TI"M %W - Week number of the year. The week starts with Monday. (00..53) ;TI" ;TI"#Seconds since the Unix Epoch: ;TI"= %s - Number of seconds since 1970-01-01 00:00:00 UTC. ;TI"B %Q - Number of milliseconds since 1970-01-01 00:00:00 UTC. ;TI" ;TI"Literal string: ;TI"# %n - Newline character (\n) ;TI" %t - Tab character (\t) ;TI"$ %% - Literal ``%'' character ;TI" ;TI"Combination: ;TI"+ %c - date and time (%a %b %e %T %Y) ;TI" %D - Date (%m/%d/%y) ;TI"0 %F - The ISO 8601 date format (%Y-%m-%d) ;TI" %v - VMS date (%e-%b-%Y) ;TI" %x - Same as %D ;TI" %X - Same as %T ;TI"' %r - 12-hour time (%I:%M:%S %p) ;TI"! %R - 24-hour time (%H:%M) ;TI"$ %T - 24-hour time (%H:%M:%S) ;TI". %+ - date(1) (%a %b %e %H:%M:%S %Z %Y) ;T; 0o; ; [I"HThis method is similar to the strftime() function defined in ISO C ;TI"and POSIX. ;TI"NSeveral directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z) ;TI"+are locale dependent in the function. ;TI"1However, this method is locale independent. ;TI"OSo, the result may differ even if the same format string is used in other ;TI"systems such as C. ;TI"LIt is good practice to avoid %x and %X because there are corresponding ;TI"3locale independent representations, %D and %T.;T@o; ; [I"Examples:;T@o; ; [ I"3d = DateTime.new(2007,11,19,8,37,48,"-06:00") ;TI"M #=> # ;TI"Ed.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007" ;TI":d.strftime("at %I:%M%p") #=> "at 08:37AM" ;T; 0o; ; [I"Various ISO 8601 formats:;To; ; ['I"I%Y%m%d => 20071119 Calendar date (basic) ;TI"L%F => 2007-11-19 Calendar date (extended) ;TI"c%Y-%m => 2007-11 Calendar date, reduced accuracy, specific month ;TI"b%Y => 2007 Calendar date, reduced accuracy, specific year ;TI"e%C => 20 Calendar date, reduced accuracy, specific century ;TI"H%Y%j => 2007323 Ordinal date (basic) ;TI"K%Y-%j => 2007-323 Ordinal date (extended) ;TI"E%GW%V%u => 2007W471 Week date (basic) ;TI"H%G-W%V-%u => 2007-W47-1 Week date (extended) ;TI"f%GW%V => 2007W47 Week date, reduced accuracy, specific week (basic) ;TI"i%G-W%V => 2007-W47 Week date, reduced accuracy, specific week (extended) ;TI"F%H%M%S => 083748 Local time (basic) ;TI"I%T => 08:37:48 Local time (extended) ;TI"i%H%M => 0837 Local time, reduced accuracy, specific minute (basic) ;TI"l%H:%M => 08:37 Local time, reduced accuracy, specific minute (extended) ;TI"_%H => 08 Local time, reduced accuracy, specific hour ;TI"s%H%M%S,%L => 083748,000 Local time with decimal fraction, comma as decimal sign (basic) ;TI"v%T,%L => 08:37:48,000 Local time with decimal fraction, comma as decimal sign (extended) ;TI"w%H%M%S.%L => 083748.000 Local time with decimal fraction, full stop as decimal sign (basic) ;TI"z%T.%L => 08:37:48.000 Local time with decimal fraction, full stop as decimal sign (extended) ;TI"b%H%M%S%z => 083748-0600 Local time and the difference from UTC (basic) ;TI"e%T%:z => 08:37:48-06:00 Local time and the difference from UTC (extended) ;TI"b%Y%m%dT%H%M%S%z => 20071119T083748-0600 Date and time of day for calendar date (basic) ;TI"e%FT%T%:z => 2007-11-19T08:37:48-06:00 Date and time of day for calendar date (extended) ;TI"a%Y%jT%H%M%S%z => 2007323T083748-0600 Date and time of day for ordinal date (basic) ;TI"d%Y-%jT%T%:z => 2007-323T08:37:48-06:00 Date and time of day for ordinal date (extended) ;TI"^%GW%V%uT%H%M%S%z => 2007W471T083748-0600 Date and time of day for week date (basic) ;TI"a%G-W%V-%uT%T%:z => 2007-W47-1T08:37:48-06:00 Date and time of day for week date (extended) ;TI"X%Y%m%dT%H%M => 20071119T0837 Calendar date and local time (basic) ;TI"[%FT%R => 2007-11-19T08:37 Calendar date and local time (extended) ;TI"W%Y%jT%H%MZ => 2007323T0837Z Ordinal date and UTC of day (basic) ;TI"Z%Y-%jT%RZ => 2007-323T08:37Z Ordinal date and UTC of day (extended) ;TI"l%GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic) ;TI"o%G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended) ;T; 0o; ; [I")See also strftime(3) and ::strptime.;T: @fileI"ext/date/date_core.c;T:0@omit_headings_from_table_of_contents_below0I"+d.strftime([format='%F']) -> string ;T0[I" (*args);T@ÅFI" Date;TcRDoc::NormalClass00