addDays(now(),-8)

addDays(now(),-8) results in 2022-12-27

Ignition 7.9.18
Java 8 311

nop

Can you show how you are getting that result? In a specific component, script, etc.?

Thx. You are right that addDays(now(),-8)) returns the correct date. I thought that was the problem.

But no, dateFormat(addDays(now(),-8),‘YYYY-MM-dd’) returns 2022-12-27. Am I using dateFormat correctly?

No, you’re not :slight_smile:
YYYY is week year, not calendar year (yyyy):
https://docs.inductiveautomation.com/display/DOC81/Data+Type+Formatting+Reference

3 Likes