View Full Version : Getting the date and time in C

10-12-2001, 10:23 AM
Does anyone know how to get the date and time in C and then print it out to the screen?

11-12-2001, 01:45 AM
I haven't tried it but K&R says the functions are declared in time.h

11-12-2001, 08:18 AM

int main(void)
time_t timer;

printf('The current time is %s\n',asctime(localtime(&timer)));
return 0;