Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode custom header template: ___DATE___ format

Tags:

xcode

gcc

macros

As in title, I just want set a custom format for macro ___DATE___ : is it possibile?

Default format is mm/dd/yy, but I would like to have yyyy-mm-dd

Also, I can't find official documentation for all available macros.

Thanks

like image 752
Luca Davanzo Avatar asked Sep 26 '26 07:09

Luca Davanzo


2 Answers

The format for the ___DATE___ parameter can be set in Settings.app.

Settings.app -> General -> Language & Region -> Date format

Then set the Short format to be how you want it to appear.

like image 151
yonomitt Avatar answered Sep 28 '26 22:09

yonomitt


The __DATE__ macro is part of the C++ standard, and the format is specified precisely by that standard (as Mmm dd yyyy, not mm/dd/yy). That is what I'd expect XCode to produce for an Objective-C program; I know nothing about Swift.

You can find a list of macros defined by GCC in the Gnu CPP documentation. I believe Clang (used by default by XCode) implements the same ones.

like image 26
rici Avatar answered Sep 28 '26 20:09

rici



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!