minix/commands/zoneinfo/newstrftime.3
Ben Gras 3b2c65e323 Import of original zoneinfo code and database - tzcode
old-tzcode-32-bit-output and tzdata2007d.
2007-03-26 10:55:16 +00:00

230 lines
6.6 KiB
Groff

.\" 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)
.\" @(#)newstrftime.3 7.15