strftime()函数中的格式字符

您所在的位置:网站首页 linux中时间格式 strftime()函数中的格式字符

strftime()函数中的格式字符

#strftime()函数中的格式字符| 来源: 网络整理| 查看: 265

time.h中的strftime函数用于把struct tm转换为字符串输出,类似于printf,我们可以为其指定格式,下表是其使用的格式字符

 

来源:http://www.cplusplus.com/reference/clibrary/ctime/strftime/

specifierReplaced byExample%aAbbreviated weekday name *Thu%AFull weekday name *Thursday%bAbbreviated month name *Aug%BFull month name *August%cDate and time representation *Thu Aug 23 14:55:02 2001%dDay of the month (01-31)23%HHour in 24h format (00-23)14%IHour in 12h format (01-12)02%jDay of the year (001-366)235%mMonth as a decimal number (01-12)08%MMinute (00-59)55%pAM or PM designationPM%SSecond (00-59)02%UWeek number with the first Sunday as the first day of week one (00-53)33%wWeekday as a decimal number with Sunday as 0 (0-6)4%WWeek number with the first Monday as the first day of week one (00-53)34%xDate representation *08/23/01%XTime representation *14:55:02%yYear, last two digits (00-99)01%YYear2001%ZTimezone name or abbreviationCDT%%A % sign% * The specifiers whose description is marked with an asterisk (*) are locale-dependent.

 

 



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3