strftime.3

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 122 行

3
122
字号
.TH strftime 3.SH Namestrftime \- convert time and date to string.SH Syntax.B #include <time.h>.PP.B int strftime (\fIs, maxsize, format, tm\fP).br.B char *\fIs\fP;.br.B size_t \fImaxsize\fP;   .br.B char *\fIformat\fP;.br.B struct tm *\fItm\fP;.SH Description.NXR "strftime subroutine".PPThe.PN strftimefunction places characters in the array pointed to by \fIs\fR.No more than \fImaxsize\fR characters are placed into the array.The.PN formatstring controls this process.This string consists of zero or more directives and ordinary characters.A directive consists of a.PN %character followed by a character that determines the behavior of the directive.  All ordinary characters are copied unchanged into the array, including the terminating null character..PPEach directive is replaced by the appropriate characters as shown in the following table. The characters are determined by the program's locale category.PN LC_TIMEand the values contained in the structure pointed to by \fItm\fP..PP.TStab(@);lp-1v-1fHB lp-1v-1fHBlp-1v-1 lp-1v-1..sp 6p_.sp 6pDirective@Replaced by.sp 6p_.sp 6p%a@Locale's abbreviated weekday name%A@Locale's full weekday name%b@Locale's abbreviated month name%B@Locale's full month name%c@Locale's date and time representation%d@Day of month as a decimal number (01\-31)%D@Date (%m/%d/%y)%h@Locale's abbreviated month name%H@Hour as a decimal number (00\-23)%I@Hour as a decimal number (01\-12)%j@Day of year (001\-366)%m@Number of month (01\-12)%M@Minute number (00\-59)%n@Newline character%p@Locale's equivalent to AM or PM%r@Time in AM/PM notation%S@Second number (00\-59)%t@Tab character%T@Time (%H/%M/%S)%U@Week number (00\-53), Sunday as first day of week%w@Weekday number (0[Sunday]\-6)%W@Week number (00\-53), Monday as first day of week%x@Locale's date representation%X@Locale's time representation%y@Year without century (00\-99)%Y@Year with century%Z@Timezone name, no characters if no timezone%%@%.sp 6p_.TE.PPIf a directive is used that is not contained in the table, the results are undefined..SS International Environment.IP LC_TIME 15Contains the user's requirements for language, territory, and codeset forthe time format. .PN LC_TIME affects the behavior of the time functions in.PN strftime .If.PN LC_TIMEis not defined in the current environment, .PN LANGprovides the necessary default..IP LANG 15If this environment is set and valid, .PN strftimeuses the international language database named in the definition to determinethe time formatting rules. If.PN LC_TIME is defined, its definition supercedes the definition of .PN LANG ..SH Return ValuesIf the total number of resulting characters, including the terminal null character, is not more than \fImaxsize\fR, the.PN strftimefunction returns the total of resultant characters placed into the array pointed to by \fIs\fR, not including the terminating null character.In all other cases zero is returned and the contents of the array are indeterminate..PPAs the.PN timezonename is not contained in the \fItm\fR structure the value returned by \fI%Z\fR is determined by the.PN timezonefunction, see.PN ctime ..SH See Alsoctime(3), setlocale(3)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?