[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

Getting time and date with preprocessor

In my application I want to display the build time and date in about box.
That is the time/date the EXE was built.
Therefore I need the actual time and date at compile time.

Anybody know an easy way to get this time and date?
I don't want to take the file date at run-time.

A preprocessor macro would be fine.
Any ideas ?

  • 2
1 Solution
PacmanAuthor Commented:
Compiler is MS VC6.0 ...
doesn't have to be ANSI solution
To help you perform such processing, the C preprocessor assigns the constants __DATE__ and __TIME__ to the current date and time.
printf("Beta testing: Last compiled %s %s", __DATE__, __TIME__);
PacmanAuthor Commented:
That's it!
Thank you

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now