In my application, I'm trying to retrieve the current year in a scripted field.
The idea was (in pseudocode):
calculated = currentYear - doc['field'].value return calculated;
I tried with:
Instant Currentdate = Instant.ofEpochMilli(new Date().getTime());
And actually retrieves the current timestamp, but i can't access the Year value.
Is it possible, and if yes how, to get the current year value in Painless as an integer number?
Thank you for your time and patience!