ANSI-defined Format Specifiers for strftime

From Appmethod Topics
Jump to: navigation, search

Go Up to strftime,_wcsftime

The following table describes the ANSI-defined specifiers for the format string used with strftime.

Format Specifier Substitutes

%%

%#%

%a

%#a

%A

%#A

%b

%#b

%B

%#B

%c

%#c

%d

%#d

%H

%#H

%I

%#I

%j

%#j

%m

%#m

%M

%#M

%p

%#p

%S

%#S

%U

%#U

%w

%#w

%W

%#W

%x

%#x

%X

%#X

%y

%#y

%Y

%#Y

%Z, %z

%#Z

Character %

Character %, flag is ignored

Abbreviated weekday name

Abbreviated weekday name, flag is ignored

Full weekday name

Full weekday name, flag is ignored

Abbreviated month name

Abbreviated month name, flag is ignored

Full month name

Full month name, flag is ignored

Date and time

Long date and time representation, appropriate for current locale. For example: Tuesday, March 14, 1995, 12:41:29

Two-digit day of month (01 - 31)

Two-digit day of month, remove leading zeros (if any)

Hour of the day, 24 hour day

Hour of the day, 24 hour day, remove leading zeros (if any)

Two-digit hour, 12 hour day (01 - 12)

Two-digit hour, 12 hour day, remove leading zeros (if any)

Three-digit day of year (001 - 366)

Three-digit day of year, remove leading zeros (if any)

Two-digit month as a decimal number (1 - 12)

Two-digit month as a decimal number, remove leading zeros (if any)

2-digit minute (00 - 59)

2-digit minute, remove leading zeros (if any)

AM or PM

AM or PM, flag is ignored

Two-digit second (00 - 59)

Two-digit second, remove leading zeros (if any)

Two-digit week number where Sunday is the first day of the week (00 - 53)

Two-digit week number where Sunday is the first day of the week, remove leading zeros (if any)

Weekday where 0 is Sunday (0 - 6)

Weekday where 0 is Sunday, remove leading zeros (if any)

Two-digit week number where Monday is the first day of week the week (00 - 53)

Two-digit week number where Monday is the first day of week the week, remove leading zeros (if any)

Date

Long date representation, appropriate to current locale. For example: Tuesday, March 14, 1995

Time

Time, flag is ignored

Two-digit year without century (00 to 99)

Two-digit year without century, remove leading zeros (if any)

Year with century

Year with century, remove leading zeros (if any)

Time zone name, or no characters if no time zone

Time zone name, or no characters if no time zone, flag is ignored

See Also