Previous Year

2
How can I get previous year in year format ??
asked
2 answers
3

Hello, 
If you want to use the current year, just use the formatDateTime() function.
Ex:

formatDateTime(addYears([%CurrentDateTime%], -1), 'yyyy')

answered
1

You can use the formatDateTime to just get the year from a date as a String, and you can add -1 years to a date using addYears. Something like this should work.


https://docs.mendix.com/refguide/parse-and-format-date-function-calls/#5-formatdateutc
https://docs.mendix.com/refguide/add-date-function-calls/#10-addyearsutc

 

formatDateTime(addYears([%CurrentDateTime%], -1), 'yyyy')
answered