asctime, asctime_r, asctime_s
Defined in header
char* asctime ( const struct tm* time_ptr );
char* asctime_r( const struct tm* time_ptr, char* buf );
errno_t asctime_s( char* buf, rsize_t bufsz, const struct tm* time_ptr );
Www- three-letter English abbreviated day of the week from time_ptr->tm_wday, one of
Mmm- three-letter English abbreviated month name from time_ptr->tm_mon, one of
dd- 2-digit day of the month from timeptr->tm_mday as if printed by sprintf using %2d
hh- 2-digit hour from timeptr->tm_hour as if printed by sprintf using %.2d
mm- 2-digit minute from timeptr->tm_min as if printed by sprintf using %.2d
ss- 2-digit second from timeptr->tm_sec as if printed by sprintf using %.2d
yyyy- 4-digit year from timeptr->tm_year + 1900 as if printed by sprintf using %4d
buf, which is guaranteed to be null-terminated.
bufis less than 26 bytes.
buf, which is guaranteed to be null-terminated, and the following errors are detected at runtime and call the currently installed constraint handler function:
time_ptris a null pointer
bufszis less than 26 or greater than RSIZE_MAX
- not all members of *time_ptr are within their normal ranges
- the year indicated by time_ptr->tm_year is less than 0 or greater than 9999
- As with all bounds-checked functions,
asctime_sis only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including
|time_ptr||-||pointer to a tm object specifying the time to print|
|buf||-||pointer to a user-supplied buffer at least 26 bytes in length|
|bufsz||-||size of the user-supplied buffer|
 Return value
asctimeand ctime, and may be overwritten on each invocation of any of those functions.
buf, which points to a null-terminated character string holding the textual representation of date and time as described above after returning.
bufis a null pointer or
bufszis zero or greater than RSIZE_MAX).
asctime returns a pointer to static data and is not thread-safe. POSIX marks this function obsolete and recommends strftime instead. The C standard also recommends strftime instead of
strftime is more flexible and locale-sensitive.
POSIX limits undefined behaviors only to when the output string would be longer than 25 characters, when
timeptr->tm_mon are not within the expected ranges, or when
timeptr->tm_year exceeds INT_MAX-1990.
Some implementations handle timeptr->tm_mday==0 as meaning the last day of the preceding month.
Tue May 26 21:51:50 2015 Tue May 26 21:51:50 2015
- C11 standard (ISO/IEC 9899:2011):
- 184.108.40.206 The asctime function (p: 392-393)
- K.220.127.116.11 The asctime_s function (p: 624-625)
- C99 standard (ISO/IEC 9899:1999):
- 18.104.22.168 The asctime function (p: 341-342)
- C89/C90 standard (ISO/IEC 9899:1990):
- 22.214.171.124 The asctime function
 See also
| converts a |
| converts a |
C++ documentation for asctime