This will produce output similar to Unix date with no arguments. You can, of course, print it out however you like, look into the standard time libraries.
#include <stdio.h>
#include <time.h>
int main(void)
{
struct tm *p;
long tmm;
char *wk_days[] = { "Sun","Mon","Tue","Wed","Thu","Fri","Sat" };
char *mo_days[] = { "Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug","Sep","Oct","Nov","Dec" };
time(&tmm);
if ((p=localtime(&tmm))!=NULL) {
printf("%s %s %2d %2.2d:%2.2d:%2.2d %s %d\n",wk_days[p->tm_wday],
mo_days[p->tm_mon],
p->tm_mday,
p->tm_hour,
p->tm_min,
p->tm_sec,
tzname[1],
p->tm_year+1900);
}
return 0;
}
Regards [sig]<p>Russ<br><a href=mailto:bobbitts@hotmail.com>bobbitts@hotmail.com</a><br><a href=
is in</a><br>[/sig]