diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-07-09 21:02:59 +0000 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-07-09 21:02:59 +0000 |
| commit | 5adafd6d794fa93ca40e6af9c149112c10059436 (patch) | |
| tree | cf77c73082ea01e9bdf5a94a93fb7946e563c0de /man3/strftime.3 | |
| parent | d089e7b597f53d4eb29c7409c342f7e3f0c5fe59 (diff) | |
| download | man-pages-5adafd6d794fa93ca40e6af9c149112c10059436.tar.gz | |
ffix
Diffstat (limited to 'man3/strftime.3')
| -rw-r--r-- | man3/strftime.3 | 106 |
1 files changed, 77 insertions, 29 deletions
diff --git a/man3/strftime.3 b/man3/strftime.3 index 5caea1a411..f82ce26144 100644 --- a/man3/strftime.3 +++ b/man3/strftime.3 @@ -79,34 +79,48 @@ The century number (year/100) as a 2-digit integer. (SU) The day of the month as a decimal number (range 01 to 31). .TP .B %D -Equivalent to %m/%d/%y. (Yecch \(em for Americans only. -Americans should note that in other countries %d/%m/%y is rather -common. +Equivalent to +.BR %m/%d/%y . +(Yecch \(em for Americans only. +Americans should note that in other countries +.BR %d/%m/%y +is rather common. This means that in international context this format is ambiguous and should not be used.) (SU) .TP .B %e -Like %d, the day of the month as a decimal number, but a leading +Like +.BR %d , +the day of the month as a decimal number, but a leading zero is replaced by a space. (SU) .TP .B %E Modifier: use alternative format, see below. (SU) .TP .B %F -Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99) +Equivalent to +.B %Y-%m-%d +(the ISO 8601 date format). (C99) .TP .B %G The ISO 8601 year with century as a decimal number. -The 4-digit year corresponding to the ISO week number (see %V). -This has the same format and value as %y, except that if the +The 4-digit year corresponding to the ISO week number (see +.BR %V ). +This has the same format and value as +.BR %y , +except that if the ISO week number belongs to the previous or next year, that year is used instead. (TZ) .TP .B %g -Like %G, but without century, that is, with a 2-digit year (00-99). (TZ) +Like +.BR %G , +but without century, that is, with a 2-digit year (00-99). (TZ) .TP .B %h -Equivalent to %b. (SU) +Equivalent to +.BR %b . +(SU) .TP .B %H The hour as a decimal number using a 24-hour clock (range 00 to 23). @@ -119,11 +133,15 @@ The day of the year as a decimal number (range 001 to 366). .TP .B %k The hour (24-hour clock) as a decimal number (range 0 to 23); -single digits are preceded by a blank. (See also %H.) (TZ) +single digits are preceded by a blank. (See also +.BR %H .) +(TZ) .TP .B %l The hour (12-hour clock) as a decimal number (range 1 to 12); -single digits are preceded by a blank. (See also %I.) (TZ) +single digits are preceded by a blank. (See also +.BR %I .) +(TZ) .TP .B %m The month as a decimal number (range 01 to 12). @@ -143,16 +161,22 @@ corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'. .TP .B %P -Like %p but in lowercase: `am' or `pm' or a corresponding +Like +.B %p +but in lowercase: `am' or `pm' or a corresponding string for the current locale. (GNU) .TP .B %r The time in a.m. or p.m. notation. -In the POSIX locale this is equivalent to `%I:%M:%S %p'. (SU) +In the POSIX locale this is equivalent to +.BR %I:%M:%S %p . +(SU) .TP .B %R -The time in 24-hour notation (%H:%M). (SU) -For a version including the seconds, see %T below. +The time in 24-hour notation (\fB%H:%M\fP). (SU) +For a version including the seconds, see +.B %T +below. .TP .B %s The number of seconds since the Epoch, that is, since 1970-01-01 @@ -166,28 +190,38 @@ The second as a decimal number (range 00 to 60). A tab character. (SU) .TP .B %T -The time in 24-hour notation (%H:%M:%S). (SU) +The time in 24-hour notation (\fB%H:%M:%S\fP). (SU) .TP .B %u The day of the week as a decimal, range 1 to 7, Monday being 1. -See also %w. (SU) +See also +.BR %w . +(SU) .TP .B %U The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. -See also %V and %W. +See also +.B %V +and +.BR %W . .TP .B %V The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. -See also %U and %W. (SU) +See also +.B %U +and +.BR %W . +(SU) .TP .B %w The day of the week as a decimal, range 0 to 6, Sunday being 0. -See also %u. +See also +.BR %u . .TP .B %W The week number of the current year as a decimal number, @@ -252,7 +286,9 @@ very old versions of libc, such as libc 4.4.1, would return \fImax\fP if the array was too small.) .LP Note that the return value 0 does not necessarily indicate an error; -for example, in many locales %p yields an empty string. +for example, in many locales +.B %p +yields an empty string. .SH ENVIRONMENT The environment variables TZ and .B LC_TIME @@ -262,17 +298,22 @@ SVr4, C89, C99. There are strict inclusions between the set of conversions given in ANSI C (unmarked), those given in the Single Unix Specification (marked SU), those given in Olson's timezone package (marked TZ), -and those given in glibc (marked GNU), except that %+ is not supported -in glibc2. +and those given in glibc (marked GNU), except that +.B %+ +is not supported in glibc2. On the other hand glibc2 has several more extensions. POSIX.1 only refers to ANSI C; POSIX.2 describes under .BR date (1) several extensions that could apply to .BR strftime () as well. -The %F conversion is in C99 and POSIX.1-2001. +The +.B %F +conversion is in C99 and POSIX.1-2001. -In SUSv2, the %S specifier allowed a range of 00 to 61, +In SUSv2, the +.B %S +specifier allowed a range of 00 to 61, to allow for the theoretical possibility of a minute that included a double leap second (there never has been such a minute). @@ -310,18 +351,25 @@ Convert alphabetic characters in result string to upper case. .B # Swap the case of the result string. (This flag only works with certain conversion specifier characters, -and of these, it is only really useful with %Z). +and of these, it is only really useful with +.BR %Z ). .PP An optional decimal width specifier may follow the (possibly absent) flag. If the natural size of the field is smaller than this width, then the result string is padded (on the left) to the specified width. .SH BUGS -Some buggy versions of gcc complain about the use of %c: +Some buggy versions of +.BR gcc (1) +complain about the use of +.BR %c : .IR "warning: `%c' yields only last 2 digits of year in some locales" . -Of course programmers are encouraged to use %c, it gives the preferred +Of course programmers are encouraged to use +.BR %c , it gives the preferred date and time representation. One meets all kinds of strange obfuscations -to circumvent this gcc problem. +to circumvent this +.BR gcc (1) +problem. A relatively clean one is to add an intermediate function .in +0.5i |
