Table of Contents
Previous Section Next Section

asctime

#include <time.h>char *asctime(const struct tm *ptr);

The asctime( ) function returns a pointer to a string that contains the information stored in the structure pointed to by ptr converted into the following form:

day month date hours:minutes:seconds year\n\0

For example:

Fri Apr 15 12:05:34 2005

The structure pointed to by ptr is usually obtained from either localtime( ) or gmtime( ).

The buffer used by asctime( ) to hold the formatted output string is a statically allocated character array and is overwritten each time the function is called. If you want to save the contents of the string, you must copy it elsewhere.

Related functions are localtime( ), gmtime( ), time( ), and ctime( ).


Table of Contents
Previous Section Next Section