Paul
Paul

Reputation: 11

Need Lotus-Formula code to full in current date in particular format

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

Upvotes: 1

Views: 98

Answers (1)

Knut Herrmann
Knut Herrmann

Reputation: 30960

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.

Upvotes: 2

Related Questions