Is there a cross-platform way to get the current date and time in C++?
There's always the __TIMESTAMP__ preprocessor macro.
__TIMESTAMP__
#include using namespace std void printBuildDateTime () { cout << __TIMESTAMP__ << endl; } int main() { printBuildDateTime(); }
example: Sun Apr 13 11:28:08 2014