asctime()
含义:Return the date and time as a character string(标准时间换算)
Format
asctime(clock,[format])
Parameters
Paramter | Definition |
clock | reference to the clock or timer whose value should be converted to a character string The clock is most commonly time(). |
format | optional format symbol for the asctime() output string Default |
Table 3
编辑
编辑
Description
The asctime() function returns the date/time of clock as a character string. It is equivalent to the C library asctime() function except that the PSL asctime() function adjusts the value to the local timezone. If format is given, asctime() returns the date/time string in the specified format.
Example
Code:
raw_time=time();
default_output=asctime(raw_time);
output_with_format=asctime(raw_time,"Day is %A,Month is %B,Time is %X\nTimeZone is %Z");printf("raw time is %d,default asctime() output is %s\n",raw_time,default_output);
printf("%s\n",output_with_format);
Output: