Asctime() - C library function Program

Declaration :

char *asctime(const struct tm *timeptr)

Explanation :

PurposeThe C library function char *asctime(const struct tm *timeptr) returns a pointer to a string which represents the day and time of the structure struct timeptr.
Parameters
Return ValueThis function returns a C string containing the date and time information in a human-readable format Www Mmm dd hh:mm:ss yyyy Where Www is the weekday Mmm the month in letters dd the day of the month hh:mm:ss the time and yyyy the year.
Exception

C Program : Example

The following example shows the usage of asctime() function.

#include 
#include 
#include 
int main()
{
   struct tm t;
   t.tm_sec    = 10;
   t.tm_min    = 10;
   t.tm_hour   = 6;
   t.tm_mday   = 25;
   t.tm_mon    = 2;
   t.tm_year   = 89;
   t.tm_wday   = 6;
   puts(asctime(&t));
   return(0);
}