# system.db.dateFormat returning incorrect year

**URL:** <https://forum.inductiveautomation.com/t/system-db-dateformat-returning-incorrect-year/41846>\
**Category:** Ignition\
**Created:** [December 29, 2020, 5:44pm UTC](https://forum.inductiveautomation.com/t/system-db-dateformat-returning-incorrect-year/41846 "2020-12-29T17:44:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmonter](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jmonter](https://forum.inductiveautomation.com/u/jmonter)\
**Post date:** [December 29, 2020, 5:44pm UTC](https://forum.inductiveautomation.com/t/system-db-dateformat-returning-incorrect-year/41846/1 "2020-12-29T17:44:51Z")

</div>

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](https://docs.inductiveautomation.com/display/DOC80/system.date.format)
