Mega Code Archive

 
Categories / C++ Tutorial / Data Types
 

Demonstrating the use of the localtime( ) and asctime( ) functions

#include <time.h> #include <stdio.h> struct tm *date_time; time_t timer; int main( ) {  time(&timer);  date_time=localtime(&timer);  printf("The present date and time is: %s\n",  asctime(date_time));  return (0); }