Tuesday, April 26, 2011

C Program to print local Date and Time

#include <STDIO.H> 
#include <TIME.H> 
int current_day(void) 
{
 struct tm *local; 
  time_t t; 
 t = time(NULL); 
 local = localtime(&t); 
 return local->tm_wday; 

int main(int argc, char *argv[]) 

  printf("Today: %d\n", current_day()); 
  exit(0); 
}
 

No comments:

Post a Comment