How to use ctime() to get the current date & time in textual representation with C

1 Answer

0 votes
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t tm = time(NULL);
    printf("%s", ctime(&tm));
 
    return 0;
}
  
/*
run:
 
Sat Aug 27 11:44:30 2016

*/

 



answered Aug 27, 2016 by avibootz
...