| www.delorie.com/djgpp/doc/libc-2.01/libc_608.html | search |
#include <time.h> size_t strftime(char *buf, size_t n, const char *format, const struct tm *time);
This function formats the given time according to the given format and stores it in buf, not exceeding n bytes.
The format string is like printf in that any character other than
% is added to the output string, and for each character following
a % a pattern is added to the string as follows, with the
examples as if the time was Friday, October 1, 1993, at 03:30:34 PM EDT:
%A
Friday)
%a
Fri)
%B
October)
%b
%h
Oct)
%C
%a %b %e %H:%M:%S %Y (Fri Oct 1 15:30:34 1993)
%c
%m/%d/%y %H:%M:%S (10/01/93 15:30:34)
%e
2)
%D
%m/%d/%y (10/01/93)
%d
02)
%H
15)
%I
03)
%j
275)
%k
15)
%l
3)
%M
30)
%m
10)
%n
\n)
%p
PM)
%R
%H:%M (15:30)
%r
%I:%M:%S %p (03:30:35 PM)
%S
35)
%T
%X
%H:%M:%S (15:30:35)
%t
\t)
%U
39)
%W
39)
%w
5)
%x
%m/%d/%y (10/01/93)
%y
93)
%Y
1993)
%Z
EDT)
%%
%)
The number of characters stored.
struct tm t; char buf[100]; strftime(buf, 100, "%B %d, %Y", &t);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |