{{keywords>wiki library source code example reference}}
===== asctime =====
char *asctime(const struct tm *timeptr);
=== Description ===
The function asctime() converts the time in the struct ptr to a character string of the format:
Day Month Date Hour:Minute:Second Year\n\0
===== asctime C Sourcecode Example =====
/*
* asctime example code
* http://code-reference.com/c/time.h/asctime
*/
#include
#include
int main ( void )
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "Current Date is: %s", asctime (timeinfo) );
return 0;
}
==== asctime output ====
Current Date is: Sat Apr 21 13:13:46 2012
==== see also ====
[[c:time.h:localtime|localtime()]] [[c:time.h:gmtime|gmtime()]] [[c:time.h:time|time()]] [[c:time.h:ctime|ctime()]]