展开全部
time_t nTimer = time(NULL);
struct tm *pTm = localtime(nTimer);
tm 结构里保存了时间的各种信息(年月日时分秒等)
The fields of the structure type tm store the following values, each of which is an int:
tm_sec
Seconds after minute (0 – 59).
tm_min
Minutes after hour (0 – 59).
tm_hour
Hours after midnight (0 – 23).
tm_mday
Day of month (1 – 31).
tm_mon
Month (0 – 11; January = 0).
tm_year
Year (current year minus 1900).
tm_wday
Day of week (0 – 6; Sunday = 0).
tm_yday
Day of year (0 – 365; January 1 = 0).
tm_isdst
Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown. If the TZ environment variable is set, the C run-time library assumes rules appropriate to the United States for implementing the calculation of daylight-saving time (DST).
struct tm *pTm = localtime(nTimer);
tm 结构里保存了时间的各种信息(年月日时分秒等)
The fields of the structure type tm store the following values, each of which is an int:
tm_sec
Seconds after minute (0 – 59).
tm_min
Minutes after hour (0 – 59).
tm_hour
Hours after midnight (0 – 23).
tm_mday
Day of month (1 – 31).
tm_mon
Month (0 – 11; January = 0).
tm_year
Year (current year minus 1900).
tm_wday
Day of week (0 – 6; Sunday = 0).
tm_yday
Day of year (0 – 365; January 1 = 0).
tm_isdst
Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown. If the TZ environment variable is set, the C run-time library assumes rules appropriate to the United States for implementing the calculation of daylight-saving time (DST).
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询