asctime
Defined in header <time.h>
|
||
char* asctime( const tm* time_ptr ); |
||
Converts given calendar time Template:cpp to a textual representation. The resulting string has the following format:
Www Mmm dd hh:mm:ss yyyy
Www
- the day of the week (one ofMon
,Tue
,Wed
,Thu
,Fri
,Sat
,Sun
).Mmm
- the month (one ofJan
,Feb
,Mar
,Apr
,May
,Jun
,Jul
,Aug
,Sep
,Oct
,Nov
,Dec
).dd
- the day of the monthhh
- hoursmm
- minutesss
- secondsyyyy
- years
The function does not support localization.
Contents |
Parameters
time_ptr | - | pointer to a Template:cpp object specifying the time to print |
Return value
pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between asctime
and Template:cpp, and may be overwritten on each invocation of any of those functions.
Notes
This function returns a pointer to static data and is not thread-safe. POSIX marks this function obsolete and recommends Template:cpp instead.
The behavior is undefined if the output string would be longer than 25 characters, if timeptr->tm_wday
or timeptr->tm_mon
are not within the expected ranges, or if timeptr->tm_year
exceeds Template:cpp.
Some implementations handle Template:cpp as meaning the last day of the preceding month.
Example
This section is incomplete Reason: no example |