Mega Code Archive

 
Categories / C / Development
 

Convert time_t value to tm structure in local time

#include <stdio.h> #include <time.h> int main () {   time_t rawtime;   struct tm *tminfo;   time ( &rawtime );   tminfo = localtime ( &rawtime );   printf ( "Current date and time are: %s", asctime (tminfo) );      return 0; }