User forums > Using Code::Blocks
Variable Expansion - Different Format for $(TODAY)
BackInTheSandbox:
Hello,
Is there a way change the format of the $(TODAY) from YYYY-MM-DD to DD.MM.YYYY? The background is that I'm now working for a German company doing coding on an existing codebase. I'm using abbreviations (CTRL-J) very much. But for any documentation about changes I enter dates manually, because I don't want to introduce a different date format in code where a another one is used extensively.
I guess that currently changing the format is not possible. So I'd like to suggest this a new feature. Is this the right forum for that or should I post my suggestion in one of the developer forums?
TIA
Miguel Gimenez:
Probably the best way is posting a feature request (or a patch) in a ticket:
https://sourceforge.net/p/codeblocks/tickets/
IMHO the easiest approach is creating a new variable, p.e. TODAY_EU, giving the output you want.
BackInTheSandbox:
Thanks for the suggestion. I'll work on that.
Miguel Gimenez:
If you are able to recompile C::B then just change line 436 of macrosmanager.cpp from
--- Code: ---m_Macros[_T("TODAY")] = now.Format(_T("%Y-%m-%d"));
--- End code ---
to
--- Code: ---m_Macros[_T("TODAY")] = now.Format(_T("%d.%m.%Y"));
--- End code ---
or add this line
--- Code: ---m_Macros[_T("TODAY_EU")] = now.Format(_T("%d.%m.%Y"));
--- End code ---
EDIT: (hack) you can also edit codeblocks.dll (with HxD, for example) and change the %Y-%m-%d string (search in Unicode) after TODAY to %d.%m.%Y
BlueHazzard:
--- Quote from: Miguel Gimenez on October 30, 2019, 11:36:52 am ---EDIT: (hack) you can also edit codeblocks.dll (with HxD, for example) and change the %Y-%m-%d string (search in Unicode) after TODAY to %d.%m.%Y
--- End quote ---
;D
Ii think we should add a global squirrel function that gets a formatter string and returns now.Format(formatter)... I think this is quite handy...
Navigation
[0] Message Index
[#] Next page
Go to full version