Header: time.H
Syntax:
size_t *strftime
(
char *s,
size_t n,
const char *f,
const struct tm *t
);
Purpose: Converts a tm structure to a string, placing the result in s. The conversion follows the format f, consisting of normal characters and command fields. The command fields are prefixed with a '%' character. No more than n characters will be converted. The return value is the length of the converted string.
Command Conversion Example
%a Short day name Wed
%A full day name Wednesday
%b Short month name Jul
%B Full month name July
%c Full date and time string 12 Jul 1995 11:35:23
%C (C99) Century number 19
%d Day number in month 12
%e (C99) Day of month with leading space ( 1-31) 12
%g (C99) Two digit ISO8601 week number 28
%G (C99) ISO8601 week number 28
%h (C99) Short month name See command b
%H Hour of the day (0-23) 11
%I Hour of the day half (1-12) 11
%j Day number in year 193
%m Number of month 07
%M Minutes 35
%p Day half AM
%S Seconds 23
%U Week number (starting Sundays) 28
%V (C99) Two digit ISO8601 week number See command g
%w Day number in week 3
%W Week number (starting Mondays) 28
%x Full date 12 Jul 1995
%X Full time 11:35:35
%y Year number in century 95
%Y Year number 1995
%z Timezone as a signed 4 digit number -0500
%Z Timezone name (if any) EST
%% % %
Macro Conversion
%D (C99) Equivalent to %m/%d/%y
%F (C99) Equivalent to %Y-%m-%d
%r (C99) Equivalent to writing localised 12 hour clock time
%R (C99) Equivalent to %H:%M
%T (C99) Equivalent to %H:%M:%S
|
|
|