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
For some common field symbols, see Table 3.


Default
24-character string with the following format:
Sun Sep 16 01:03:52 1973

Table 3

BMC PSL function(20)-asctime()_asctime()

编辑

BMC PSL function(20)-asctime()_asctime()_02

编辑

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:

BMC PSL function(20)-asctime()_asctime()_03