write a c program to print the current system date and time
Answers
Answered by
1
A C program to print the current system date and time
- #include <stdio.h> #include <time.h>
- char cur_time[128]; time_t t;
- struct tm* ptm; t = time(NULL);
- ptm = localtime(&t); strftime(cur_time, 128, "%d-%b-%Y %H:%M:%S", ptm);
- printf("Current date and time: %s\n", cur_time); return 0;
Similar questions