SilverScreen Solid Modeler

strftime

strftime

Previous topic Next topic  

strftime

Previous topic Next topic JavaScript is required for the print function  

StandardCLibrary

 

size_t strftime(char *s, size_t n, char *fmt, struct tm *tp)

 

char      *s;           /* character buffer to receive formatted time string */

size_t     n;           /* maximum count of characters to store */

char      *fmt;         /* format string */

struct tm *tp;          /* address of time structure */

 

 




Synopsis

#include "time.h"

 

The strftime function formats the time represented by the struct tm pointer tp into the character buffer pointed to by s , under control of the format string fmt . No more than n characters are stored in s , including the null-terminator.

 

 

Parameters

s is a character buffer that is to receive the formatted time string. n is an integer specifying the maximum number of characters to be stored into s . tp is the address of a struct tm containing a time representation. fmt is a null-terminated string containing ordinary characters and conversion specifications. Ordinary characters are copied unmodified into s ; conversion specifiers are replaced as described below.

 

A conversion specification is a '%' character followed by a conversion character. The conversion specifications are the following:

 

Code

Replacement

%a

abbreviated weekday name, e.g., "Thu"

%A

full weekday name, e.g., "Thursday"

%b

abbreviated month name, e.g. "Jan"

%B

full month name, e.g., "January"

%c

local date and time representation

%d

day of month, e.g., "01", "31"

%H

hour (24 hour clock), e.g., "00", "23"

%I

hour (12 hour clock), e.g., "01", "12"

%j

day of the year, e.g., "001", "366"

%m

month, e.g., "01", "12"

%M

minute, e.g., "00", "59"

%p

local equivalent of AM or PM

%S

second, e.g., "00", "59"

%U

week number of the year (from 1st Sunday), e.g., "00", "53"

%w

week day (Sunday is 0), e.g., "00", "06"

%W

week number of the year (from 1st Monday), e.g., "00", "53"

%x

local date representation

%X

local time representation

%y

year (no century), e.g., "00", "99"

%Y

year (with century), e.g., "1995"

%z

time zone name, if known

%Z

a single %

 

 

Return Value

strftime returns the number of characters stored in s , if less than n ; otherwise, if the string would be larger than n , strftime returns 0.

 

 

See Also

strdate , strtime