Using dateTime() or dateTimeUTC() with variable

3
I was wondering why the dateTime() and dateTimeUTC() functions only except literal integers and no variable integers? E.g. dateTimeUTC(2016) works; however, if I have an object with variable year(integer) then dateTimeUTC($object/year) does not work. This limitation also does not become apparent from the documentation.
asked
2 answers
1

I think that dateTime() and dateTimeUTC() are programmed to create final static variables and are therefore not meant to "calculate" dates. I used a workaround for the same problem by first initiating a date using dateTime() and next adding years using addYears(). I agree this is not as nice as desired, so you might want to file a ticket anyway.

answered
0

I'm running into the same problem. I would be interested in a solution or a proper workaround to incorporate dynamic variables in DateTime functions.

answered