(0032838)
|
Mark Stijnman
|
2013-04-15 10:45
|
|
I would like this too, for generating header files with build date strings, version numbers based on release dates, etc, so I figured I'd just implement it. The result is in cmTimeCommand.zip, which I've just uploaded.
This 'time' command takes a variable name, and optionally a format specifier (as defined in http://www.cplusplus.com/reference/ctime/strftime/ [^]). The default is "%Y-%m-%d %H:%M:%S", which happens to be the format the OP requested. Examples:
time(my_iso_date) // 2013-04-15 16:36:05
time(version_number "%Y.%m") // 2013.04
time(build_date "%B %d, %Y") // April 15, 2013
time(my_time "%H:%M") // 16:35
Note that I have tested this by hand, but I'm not sure how you would add a test for this feature to the regression test set, as it will produce different output every time. |
|