Arduino IDE - Get current date at compile time and insert into sketch?

Is it possible for the IDE to read the current date from the PC and insert into a string in the sketch. This is for an information screen where I want to show the date the sketch was uploaded.

At the moment I am changing this manually but would like it to be automatic. The string I am using is similar to "ver: 1.01 Uploaded on dd.mm.yy"

This library may work:
http://playground.arduino.cc/Code/Time

Sand_HK: Is it possible for the IDE to read the current date from the PC and insert into a string in the sketch. This is for an information screen where I want to show the date the sketch was uploaded.

At the moment I am changing this manually but would like it to be automatic. The string I am using is similar to "ver: 1.01 Uploaded on dd.mm.yy"

The C and C++ standards mandate that the compilers provide two magic macros that resolve to string literals: DATE gives the time the file was compiled, and TIME gives the current time of day. So you could use:

const char compile_date[] = __DATE__ " " __TIME__;

and it would be something like (note, the 3 strings adjacent to each other become pasted together as one long string):

const char compile_date[] = "Sep 22 2013 01:19:49";

MichaelMeissner,

exactly what I wanted.

Many thanks.

The compiler also has a FILE parameter that can print the sketch source filename to add to your info screen.

Serial.println(FILE);

The FILE, DATE, and TIME values are based on compile time and location, NOT on the time, date, and location that the file to be saved was last saved (to).

Do not read too much into the values.

PaulS: The FILE, DATE, and TIME values are based on compile time and location, NOT on the time, date, and location that the file to be saved was last saved (to).

Do not read too much into the values.

This neatly illustrates one of the attractions of interpreted languages - in which those values represent the situation at run time.

...R

MichaelMeissner: Thank You VERY MUCH!!!