April 23, 2012

System Time in C

System Time in C

 
This is a small example for C Programming to show how to get  system time 
 
C program that help us to get system time. 
 
#include <stdio.h>
 #include <time.h> 
 int main ()
 { 
 char *date; 
 time_t timer; 
timer=time(NULL); 
 date = asctime(localtime(&timer)); 
 printf("Current Date: %s", date); 
 getchar(); 
 return 0; 
}

-- Thanks....


No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments