C Program to get day, date and time @linux

/*
 * Program to get day, date  and time details
 */
 

#include
#include
int main()
{
 time_t t;
 char  buf[80];
 struct tm *ts;

 t=time(0);
 ts= localtime(&t);
 strftime(buf, sizeof(buf),  "%a %Y-%m-%d %H:%M:%S %Z", ts);

 printf("The day, date and  time %s\n", buf);
 return 0;
}

output :
The day, date and  time  Mon 2011-08-22 01:54:28 PDT

Comments

Popular posts from this blog

Kind of malware and Names for malicious code

List of bootloaders available on Unix like OS

Know tracers mostly available at Linux