1
votes

Get current year to fill in automatically.

The code I have creates the following:

"01/02/19: LastName: "

FIELD Comments := @Left (@Text(@Today); "2018") + "18: " + @Right(@Name([CN];@UserName); " ") + ": ";

Would like to have the "/19" (year) to automatically use the current year instead of having it hard coded. I'm sure this is ridiculously easy but I'm not a programmer. Please let me know what the code needs to be

1

1 Answers

2
votes

This should work for most of locales (language specific settings):

_Year := @Text(@Year(@Today));
_Today := @ReplaceSubstring(@Text(@Today; "D0S0"); _Year; @Right(_Year; 2));
FIELD Comments := _Today + ": " + @Right(@Name([CN];@UserName); " ") + ": ";

It replaces the 4 year's digits with the last 2 year's digits.