by Dinesh Thakur Category: Function and Pointer

The syntax of the function asctime () is written as follows:

char * asctime( const stuct tm * Tmptr);

The function *asctime () converts the broken-down time structure pointed to by *Tmptr into a string comprising exactly 26 characters. The following is an example of this:

Wed Jan 14 12:35:57 2015\n\0

The string describes day, month, day-of-month, hour: min: sec, year, new line character, and end of string character. The application of this is illustrated in Program

Illustrates asctime () function.

#include <stdio.h>

#include <time.h>
void main()
{
    time_t Date_Time;
    time(&Date_Time);
    clrscr();
    printf("%s", asctime(localtime( &Date_Time)));
}

Function asctime () in C



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles