C has a predefined macro __DATE__
, that shows the date of the compiled source file .
The date is displayed in the format "Mmm dd yyyy" .
Is there any way to be formatted this date, using macros ?
In this format "yyyy Mmm dd".
Instead of being :
Jul 19 2013
Should be :
2013 Jul 19
In C you could have a macro that generates a compound literal on the fly that has the order that you like, something like
#define FDATE (char const[]){ __DATE__[7], __DATE__[8], ..., ' ', ... , '\0' }
in all places where it matters your optimizer should be able to handle this efficiently.