| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- .\" Based on the UCB file whose copyright information appears below.
- .\" Copyright (c) 1989, 1991 The Regents of the University of California.
- .\" All rights reserved.
- .\"
- .\" This code is derived from software contributed to Berkeley by
- .\" the American National Standards Committee X3, on Information
- .\" Processing Systems.
- .\"
- .\" Redistribution and use in source and binary forms, with or without
- .\" modification, are permitted provided that the following conditions
- .\" are met:
- .\" 1. Redistributions of source code must retain the above copyright
- .\" notice, this list of conditions and the following disclaimer.
- .\" 2. Redistributions in binary form must reproduce the above copyright
- .\" notice, this list of conditions and the following disclaimer in the
- .\" documentation and/or other materials provided with the distribution.
- .\" 3. All advertising materials mentioning features or use of this software
- .\" must display the following acknowledgement:
- .\" This product includes software developed by the University of
- .\" California, Berkeley and its contributors.
- .\" 4. Neither the name of the University nor the names of its contributors
- .\" may be used to endorse or promote products derived from this software
- .\" without specific prior written permission.
- .\"
- .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- .\" SUCH DAMAGE.
- .\"
- .\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91
- .\" $Id: strftime.3,v 1.4 1993/12/15 20:33:00 jtc Exp $
- .\"
- .TH NEWSTRFTIME 3
- .SH NAME
- strftime \- format date and time
- .SH SYNOPSIS
- .nf
- .B #include <sys/types.h>
- .B #include <time.h>
- .PP
- .B size_t strftime(buf, maxsize, format, timeptr)
- .B char *buf;
- .B size_t maxsize;
- .B const char *format;
- .B const struct tm *timeptr
- .PP
- .B cc ... -ltz
- .fi
- .SH DESCRIPTION
- The
- .I strftime\^
- function formats the information from
- .I timeptr\^
- into the buffer
- .I buf\^
- according to the string pointed to by
- .IR format\^ .
- .PP
- The
- .I format\^
- string consists of zero or more conversion specifications and
- ordinary characters.
- All ordinary characters are copied directly into the buffer.
- A conversion specification consists of a percent sign
- .Ql %
- and one other character.
- .PP
- No more than
- .I maxsize\^
- characters are be placed into the array.
- If the total number of resulting characters, including the terminating
- null character, is not more than
- .IR maxsize\^ ,
- .I strftime\^
- returns the number of characters in the array, not counting the
- terminating null.
- Otherwise, zero is returned.
- .PP
- Each conversion specification is replaced by the characters as
- follows which are then copied into the buffer.
- .TP
- %A
- is replaced by the locale's full weekday name.
- .TP
- %a
- is replaced by the locale's abbreviated weekday name.
- .TP
- %B
- is replaced by the locale's full month name.
- .TP
- %b or %h
- is replaced by the locale's abbreviated month name.
- .TP
- %C
- is replaced by the century (a year divided by 100 and truncated to an integer)
- as a decimal number (00-99).
- .TP
- %c
- is replaced by the locale's appropriate date and time representation.
- .TP
- %D
- is replaced by the date in the format %m/%d/%y.
- .TP
- %d
- is replaced by the day of the month as a decimal number (01-31).
- .TP
- %e
- is replaced by the day of month as a decimal number (1-31);
- single digits are preceded by a blank.
- .TP
- %F
- is replaced by the date in the format %Y-%m-%d.
- .TP
- %G
- is replaced by the ISO 8601 year with century as a decimal number.
- .TP
- %g
- is replaced by the ISO 8601 year without century as a decimal number (00-99).
- .TP
- %H
- is replaced by the hour (24-hour clock) as a decimal number (00-23).
- .TP
- %I
- is replaced by the hour (12-hour clock) as a decimal number (01-12).
- .TP
- %j
- is replaced by the day of the year as a decimal number (001-366).
- .TP
- %k
- is replaced by the hour (24-hour clock) as a decimal number (0-23);
- single digits are preceded by a blank.
- .TP
- %l
- is replaced by the hour (12-hour clock) as a decimal number (1-12);
- single digits are preceded by a blank.
- .TP
- %M
- is replaced by the minute as a decimal number (00-59).
- .TP
- %m
- is replaced by the month as a decimal number (01-12).
- .TP
- %n
- is replaced by a newline.
- .TP
- %p
- is replaced by the locale's equivalent of either AM or PM.
- .TP
- %R
- is replaced by the time in the format %H:%M.
- .TP
- %r
- is replaced by the locale's representation of 12-hour clock time
- using AM/PM notation.
- .TP
- %S
- is replaced by the second as a decimal number (00-60).
- .TP
- %s
- is replaced by the number of seconds since the Epoch, UTC (see mktime(3)).
- .TP
- %T
- is replaced by the time in the format %H:%M:%S.
- .TP
- %t
- is replaced by a tab.
- .TP
- %U
- is replaced by the week number of the year (Sunday as the first day of
- the week) as a decimal number (00-53).
- .TP
- %u
- is replaced by the weekday (Monday as the first day of the week)
- as a decimal number (1-7).
- .TP
- %V
- is replaced by the week number of the year (Monday as the first day of
- the week) as a decimal number (01-53). If the week containing January
- 1 has four or more days in the new year, then it is week 1; otherwise
- it is week 53 of the previous year, and the next week is week 1.
- .TP
- %W
- is replaced by the week number of the year (Monday as the first day of
- the week) as a decimal number (00-53).
- .TP
- %w
- is replaced by the weekday (Sunday as the first day of the week)
- as a decimal number (0-6).
- .TP
- %X
- is replaced by the locale's appropriate time representation.
- .TP
- %x
- is replaced by the locale's appropriate date representation.
- .TP
- %Y
- is replaced by the year with century as a decimal number.
- .TP
- %y
- is replaced by the year without century as a decimal number (00-99).
- .TP
- %Z
- is replaced by the time zone name,
- or by the empty string if this is not determinable.
- .TP
- %z
- is replaced by the offset from UTC in the format +HHMM or -HHMM as appropriate,
- with positive values representing locations east of Greenwich,
- or by the empty string if this is not determinable.
- .TP
- %%
- is replaced by a single %.
- .TP
- %+
- is replaced by the date and time in date(1) format.
- .SH SEE ALSO
- date(1),
- getenv(3),
- newctime(3),
- newtzset(3),
- time(2),
- tzfile(5)
- .\" %W%
- .\" This file is in the public domain, so clarified as of
- .\" 2009-05-17 by Arthur David Olson.
|