system.db.dateFormat returning incorrect year

Hi,
I have a script on Ignition 7.7.1 that is formatting the current gateway date into YYYY-MM-DD and it has been working fine until today. Its currently returning the 2020 year as 2021.

objDate = system.tag.getTagValue("[System]Gateway/CurrentDateTime")
strDate = system.db.dateFormat(objDate,“YYYY-MM-dd”)

objDate : Mon Dec 28 12:10:21 PST 2020
strDate : 2021-12-28

– Got the answer via technical support and member gpg – Thanks –

The “ yyyy ” represents the calendar year of the date while the “ YYYY ” represents the year of the week. For example , Calendar year of date 2019–12–29 is 2019 on the other hand the date is Sunday, the first day and first week of the year 2020.

https://docs.inductiveautomation.com/display/DOC80/system.date.format

4 Likes