Category : Files from Magazines
Archive   : CUJ9301.ZIP
Filename : 1101116A

Output of file : 1101116A contained in archive : CUJ9301.ZIP
/* time1.c: Various formats of date and time */


#define BUFSIZE 128

time_t tval;
struct tm *now;
char buf[BUFSIZE];
char *fancy_format =
"Or getting really fancy:\n"
"%A, %B %d, day %j of %Y.\n"
"The time is %I:%M %p.";

/* Get current date and time */
tval = time(NULL);
now = localtime(&tval);
printf("The current date and time:\n"
"%d/%02d/%02d %d:%02d:%02d\n\n",
now->tm_mon+1, now->tm_mday, now->tm_year,
now->tm_hour, now->tm_min, now->tm_sec);
printf("Or in default system format:\n%s\n",
strftime(buf,sizeof buf,fancy_format,now);

return 0;

/* Output
The current date and time:
10/06/92 12:58:00

Or in default system format:
Tue Oct 06 12:58:00 1992

Or getting really fancy:
Tuesday, October 06, day 280 of 1992.
The time is 12:58 PM.
/* End of File */

  3 Responses to “Category : Files from Magazines
Archive   : CUJ9301.ZIP
Filename : 1101116A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: