I'm trying to add the build date and time to my Qt 5.6 project file, so far I have added:
win32 {
DEFINES += BUILDTIME=\\\"$$system('echo %time%')\\\"
DEFINES += BUILDDATE=\\\"$$system('echo %date%')\\\"
} else {
DEFINES += BUILDTIME=\\\"$$system(date '+%H:%M')\\\"
DEFINES += BUILDDATE=\\\"$$system(date '+%d/%m/%y')\\\"
}
And in the source code:
QString strBuildDT = QString::fromLocal8Bit(BUILDDATE)
+ ", " + QString::fromLocal8Bit(BUILDTIME);
Using this as an example I would get:
12/10/16, 17:39
I would like to reformat the date to display:
12 October 2016, 17:39
From research it looks like the correct date format to use would be:
DEFINES += BUILDDATE=\\\"$$system(date '+%d %B %Y')\\\"
But this doesn't work and returns and empty string for BUILDDATE.