INtime SDK Help
asctime, asctime_s, _wasctime, _wasctime_s
Note: locale support in INtime is limited to the "C" locale

Converts a time stored as a structure to a character string.

#include <time.h>

char *asctime (const struct tm *timedate);
errno_t asctime_s(char *string, rsize_t maxsize, const struct tm *timedate);

#include <wchar.h>

wchar_t *_wasctime(const struct tm *timedate);
errno_t _wasctime_s(wchar_t *string, rsize_t maxize, const struct tm *


A pointer to a valid tm time/date structure, for example obtained using gmtime or localtime.
A pointer to a buffer to store the character string result. This function assumes a pointer to a valid memory location with a size specified by maxsize.
The size of the buffer used to store the result, in characters.


The asctime function converts a time stored as a structure to a character string. The _tm value is usually obtained from a call to gmtime or localtime. Both functions can be used to fill in a tm structure, as defined in TIME.H.

The converted character string is also adjusted according to the local time zone settings.

The converted string contains exactly 26 characters and has this form:

Wed Jan 02 02:03:55 1980\n\0

All elements have a constant width. The newline character \n and the null character \0 occupy the last two positions of the string.

This function uses a 24-hour clock.

The function uses a single statically allocated buffer to hold the return string. Each call destroys the result of the previous call.

Return Values

asctime and _wasctime: a pointer to the character string.

asctime_s and _wasctime_s: Zero if successful. If there is a failure a non-zero error code is returned. Any of the following conditions cause a failure and the function will return a value of EINVAL:

Generic Text Routines

tchar.h routine _UNICODE not defined _UNICODE defined
_tasctime asctime _wasctime


Versions Defined in Include Link to
INtime 3.0
INtime 6.0 (for the wide-character and generic text versions)
See Also