Link to home
Start Free TrialLog in
Avatar of radamowi
radamowi

asked on

Date/Time

How do I get the system date/time into the heading of a Report file? I'm (really) new to C.
ASKER CERTIFIED SOLUTION
Avatar of kellyjj
kellyjj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of radamowi
radamowi

ASKER

Your answer was excellent ... BUT ... I forgot to mention I'm running under Unix!
This should work on most UNIX systems.

#include <stdio.h>
#include <time.h>

int main(void)
{
  time_t t;

  time(&t);
  printf("Today's date and time: %s\n", ctime(&t));
  return 0;
}
I'll try it out as soon as I can ... Which will probably only be tomorrow. I'll let you know how it works out.
Tried it! Tested it! Like it! "Merci beaucoup", which is French for: "I really appreciate your help in providing me with this solution"!