The strftime( ) Format Specifiers : time « Data Types « C++ Tutorial






Command           Replaced By

%a                Abbreviated weekday name

%A                Full weekday name

%b                Abbreviated month name

%B                Full month name

%c                Standard date and time string

%d                Day of month as a decimal (1-31)

%H                Hour (0-23)

%I                Hour (1-12)

%j                Day of year as a decimal (1-366)

%m                Month as decimal (1-12)

%M                Minute as decimal (0-59)

%p                Locale's equivalent of AM or PM

%S                Second as decimal (0-61)

%U                Week of year, Sunday being first day (0-53)

%w                Weekday as a decimal (0-6, Sunday being 0)

%W                Week of year, Monday being first day (0-53)

%x                Standard date string

%X                Standard time string

%y                Year in decimal without century (0-99)

%Y                Year including century as decimal

%Z                Time zone name

%%                The percent sign








2.33.time
2.33.1.Displays the current date and time
2.33.2.Show standard time and date string
2.33.3.Show a custom time and date string
2.33.4.%c specifies the standard time and date pattern
2.33.5.The strftime( ) Format Specifiers
2.33.6.Convert now to tm struct for UTC
2.33.7.Set the locale to US and get the time_put facet for US
2.33.8.Set the locale to Germany, Show standard time and date string
2.33.9.custom pattern displays hours and minutes followed by the date
2.33.10.Set the locale to Germany and get the time_put facet for Germany
2.33.11.Demonstrating the use of the localtime( ) and asctime( ) functions.
2.33.12.Demonstrating the use of the gmtime( ) and asctime( ) functions.
2.33.13.use of the strftime( ) function.
2.33.14.Demonstrating the use of the ctime( ) function.
2.33.15.Convert now to tm struct for local timezone