|
|
1.1 ! root 1: .\" Copyright (c) 1989 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)strftime.3 5.6 (Berkeley) 6/23/90 ! 19: .\" ! 20: .TH STRFTIME 3 "%Q" ! 21: .AT 3 ! 22: .SH NAME ! 23: strftime \- format date and time ! 24: .SH SYNOPSIS ! 25: .nf ! 26: .ft B ! 27: #include <sys/types.h> ! 28: #include <time.h> ! 29: #include <string.h> ! 30: ! 31: size_t ! 32: strftime(char *s, size_t maxsize, const char *format, ! 33: const struct tm *timeptr); ! 34: .ft R ! 35: .fi ! 36: .SH DESCRIPTION ! 37: The ! 38: .I strftime ! 39: function formats the information from ! 40: .I timeptr ! 41: into the buffer ! 42: .I buf ! 43: according to the string pointed to by ! 44: .IR format . ! 45: .PP ! 46: The ! 47: .I format ! 48: string consists of zero or more conversion specifications and ! 49: ordinary characters. ! 50: All ordinary characters are copied directly into the buffer. ! 51: A conversion specification consists of a percent sign (``%'') ! 52: and one other character. ! 53: .PP ! 54: No more than ! 55: .I maxsize ! 56: characters will be placed into the array. ! 57: If the total number of resulting characters, including the terminating ! 58: null character, is not more than ! 59: .IR maxsize , ! 60: .I strftime ! 61: returns the number of characters in the array, not counting the ! 62: terminating null. ! 63: Otherwise, zero is returned. ! 64: .PP ! 65: Each conversion specification is replaced by the characters as ! 66: follows which are then copied into the buffer. ! 67: .TP ! 68: .B %A ! 69: is replaced by the full weekday name. ! 70: .TP ! 71: .B %a ! 72: is replaced by the abbreviated weekday name, where the abbreviation ! 73: is the first three characters. ! 74: .TP ! 75: .B %B ! 76: is replaced by the full month name. ! 77: .TP ! 78: .B %b or %h ! 79: is replaced by the abbreviated month name, where the abbreviation is ! 80: the first three characters. ! 81: .TP ! 82: .B %C ! 83: is equivalent to ``%a %b %e %H:%M:%S %Y'' (the format produced by ! 84: .IR asctime (3). ! 85: .TP ! 86: .B %c ! 87: is equivalent to ``%m/%d/%y''. ! 88: .TP ! 89: .B %D ! 90: is replaced by the date in the format ``mm/dd/yy''. ! 91: .TP ! 92: .B %d ! 93: is replaced by the day of the month as a decimal number (01-31). ! 94: .TP ! 95: .B %e ! 96: is replaced by the day of month as a decimal number (1-31); single ! 97: digits are preceded by a blank. ! 98: .TP ! 99: .B %H ! 100: is replaced by the hour (24-hour clock) as a decimal number (00-23). ! 101: .TP ! 102: .B %I ! 103: is replaced by the hour (12-hour clock) as a decimal number (01-12). ! 104: .TP ! 105: .B %j ! 106: is replaced by the day of the year as a decimal number (001-366). ! 107: .TP ! 108: .B %k ! 109: is replaced by the hour (24-hour clock) as a decimal number (0-23); ! 110: single digits are preceded by a blank. ! 111: .TP ! 112: .B %l ! 113: is replaced by the hour (12-hour clock) as a decimal number (01-12); ! 114: single digits are preceded by a blank. ! 115: .TP ! 116: .B %M ! 117: is replaced by the minute as a decimal number (00-59). ! 118: .TP ! 119: .B %m ! 120: is replaced by the month as a decimal number (01-12). ! 121: .TP ! 122: .B %n ! 123: is replaced by a newline. ! 124: .TP ! 125: .B %p ! 126: is replaced by either ``AM'' or ``PM'' as appropriate. ! 127: .TP ! 128: .B %R ! 129: is equivalent to ``%H:%M''. ! 130: .TP ! 131: .B %r ! 132: is equivalent to ``%I:%M:%S %p''. ! 133: .TP ! 134: .B %t ! 135: is replaced by a tab. ! 136: .TP ! 137: .B %S ! 138: is replaced by the second as a decimal number (00-60). ! 139: .TP ! 140: .B %T or %X ! 141: is equivalent to ``%H:%M:%S''. ! 142: .TP ! 143: .B %U ! 144: is replaced by the week number of the year (Sunday as the first day of ! 145: the week) as a decimal number (00-53). ! 146: .TP ! 147: .B %W ! 148: is replaced by the week number of the year (Monday as the first day of ! 149: the week) as a decimal number (00-53). ! 150: .TP ! 151: .B %w ! 152: is replaced by the weekday (Sunday as the first day of the week) ! 153: as a decimal number (0-6). ! 154: .TP ! 155: .B %x ! 156: is equivalent to ``%m/%d/%y %H:%M:%S''. ! 157: .TP ! 158: .B %Y ! 159: is replaced by the year with century as a decimal number. ! 160: .TP ! 161: .B %y ! 162: is replaced by the year without century as a decimal number (00-99). ! 163: .TP ! 164: .B %Z ! 165: is replaced by the time zone name. ! 166: .TP ! 167: .B %% ! 168: is replaced by ``%''. ! 169: .SH "SEE ALSO" ! 170: date(1), ctime(3), printf(1), printf(3) ! 171: .SH STANDARDS ! 172: .B Strftime ! 173: conforms to ANSI X3.159-1989 (``ANSI C'').
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.