C language tips

xiaoxiao2021-03-19  184

Beep Printf ("/ a");

Time_t indicates time in seconds, can be converted to the following structure

Struct TM

{

INTTM_SEC; / * (0 - 61) * /

INTTM_MIN; / * (0 - 59) * /

INTTM_HOUR; / * (0 - 23) * /

INTTM_MDAY; / * (1 - 31) * /

INTTM_MON; / * (0 - 11) * /

INTTM_YEAR; / * PAST 1900 * /

INTTM_WDAY; / * (0 - 6) * /

INTTM_YDAY; / * (0 - 365) * /

INTTM_ISDST; / * DAYLIGHT SAVINGS FLAG * /

}

Time_t TVal = Time (null);

StructTM * Now = localtime (& TVAL);

Printf ("THE CURRENT DATE AND TIME: / N"

"% D /% 02D /% 02D% D:% 02D:% 02D / N / N",

Now-> TM_MON 1, now-> TM_MDAY, NOW-> TM_Year,

Now-> TM_HOUR, NOW-> TM_MIN, NOW-> TM_SEC);

The above% 02d is the number of digits, and can be added to the left.

TVAL = mktime (now);

Asctime (now) gets the time of the string

CTIME (TVAL) gets the time indicated by the string

转载请注明原文地址:https://www.9cbs.com/read-130102.html

New Post(0)