1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 18:03:44 1993 by Rik Faith (faith@cs.unc.edu)
.\" Translated into german by Markus Schmitt (fw@vieta.math.uni-sb.de)
.\"
.TH STRFTIM 3 "1. Septemper 1996" "" "Bibliotheksfunktionen"
.SH BEZEICHNUNG
strftime \- formatiert Datum und Uhrzeit
.SH "BERSICHT"
.nf
.B #include <time.h>
.sp
.BI "size_t strftime(char *" s ", size_t " max ", const char *" format ,
.BI " const struct tm *" tm );
.fi
.SH BESCHREIBUNG
Die Funktion
.B strftime()
formatiert die Zeit
.I tm
in das Format
.I format
und schreibt das Format in das Feld
.I s
der Groe
.I max.
.PP
Normale Zahlen im Format werden ohne Konvertierung in
.I s
kopiert. Konvertierungsanweisungen werden durch `%' charakterisiert und in
.I s
folgendermaen geschrieben:
.TP
.B %a
Der abgekrzte Wochentag abhngig von der momentanen locale Umgebung.
.TP
.B %A
Der gesamte Wochentag abhngig von der momentanen locale Umgebung.
.TP
.B %b
Der abgekrzte Monatsname abhngig von der momentanen locale Umgebung.
.TP
.B %B
Der volle Monatsname abhngig von der momentanen locale Umgebung.
.TP
.B %c
Das bevorzugte Datum und die bevorzugte Uhrzeit laut Einstellungen der
momentanen locale Umgebung.
.TP
.B %d
Der Tag im Monat als ganze Zahl (1 - 31).
.TP
.B %H
Die Stunde als ganze Zahl (00 - 23).
.TP
.B %I
Die Stunde als ganze Zahl (01 - 12).
.TP
.B %j
Der Tag im Jahr als ganze Zahl (001 - 366).
.TP
.B %m
Der Monat als ganze Zahl (01 - 12).
.TP
.B %M
Die Minute als ganze Zahl.
.TP
.B %p
Entweder `am' oder `pm' je nach der bergebenen Uhrzeit oder nach
der zugehrigen Zeichenkette in der momentanen locale Umgebung.
.TP
.B %S
Die Sekunde als ganze Zahl.
.TP
.B %U
Die Wochennummer des aktuellen Jahres als ganze Zahl, beginnend mit
dem ersten Sonntag als erster Tag der ersten Woche.
.TP
.B %W
Die Wochennummer des aktuellen Jahres als ganze Zahl, beginnend mit
dem ersten Montag als erster Tag der ersten Woche.
.TP
.B %w
Der Wochentag als ganze Zahl, Sonntag beginnt mit 0.
.TP
.B %x
Das bevorzugte Datum ohne die Zeit in der momentanen locale Umgebung.
.TP
.B %X
Die bevorzugte Uhrzeit ohne das Datum in der momentanen locale Umgebung.
.TP
.B %y
Das Jahr als ganze Zahl ohne das Jahrhundert (00 - 99).
.TP
.B %Y
Das Jahr als ganze Zahl mit dem Jahrhundert.
.TP
.B %Z
Die Zeitzone oder der Name oder die Abkrzung.
.TP
.B %%
Der Buchstabe `%'
.PP
Die Struktur der Zeit
.I tm
ist in
.I <time.h>
folgendermaen definiert.
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct tm
{
int tm_sec; /* Sekunden */
int tm_min; /* Minuten */
int tm_hour; /* Stunden */
int tm_mday; /* Tag im Monat */
int tm_mon; /* Monat */
int tm_year; /* Jahr */
int tm_wday; /* Tag in der Woche */
int tm_yday; /* Tag im Jahr */
int tm_isdst; /* Sommerzeit */
};
.ta
.fi
.RE
.PP
Die Struktur
.I tm
besteht aus:
.TP
.I tm_sec
Die Anzahl der Sekunden im Bereich von 0 bis 59, kann aber auch bis 61
gehn, um Sprungsekunden zuzulassen.
.TP
.I tm_min
Die Anzahl der Minuten im Bereich von 0 bis 59.
.TP
.I tm_hour
Die Anzahl der Stunden nach Mitternacht im Bereich von 0 bis 23.
.TP
.I tm_mday
Der Tag im Monat im Bereich von 1 bis 31.
.TP
.I tm_mon
Die Anzahl der Monat seit Januar im Bereich von 0 bis 11.
.TP
.I tm_year
Die Anzahl der Jahre seit 1900.
.TP
.I tm_wday
Die Anzahl der Tage seit Sonntag im Bereich von 0 bis 6.
.TP
.I tm_yday
Die Anzahl der Tage seit dem 1.Januar im Bereich von 0 bis 365.
.TP
.I tm_isdst
Dies zeigt an, ob Sommerzeit ist oder nicht. Der Wert ist positiv, wenn
Sommerzeit ist, Null, wenn nicht und negativ, wenn keine Informationen
darber vorliegen.
.SH "RCKGABEWERT"
Die Funktion
.B strftime()
liefert die Anzahl der Buchstaben zurck, die in das Feld
.I s
geschrieben wurden, allerdings ohne die NULL Zeichen am Ende.
Wenn der Wert gleich
.I max
ist, bedeutet das, da das Feld zu klein war.
.SH "KONFORM ZU"
SVID 3, POSIX, BSD 4.3, ISO 9899
.SH ANMERKUNGEN
Die Funktion untersttzt nur die Umgebungen, die in
.BR locale (7)
spezifiziert werden.
.SH "SIEHE AUCH"
.BR date (1),
.BR time (2),
.BR ctime (3),
.BR setlocale (3),
.BR sprintf (3).
|