# System.date.format Error

**URL:** <https://forum.inductiveautomation.com/t/system-date-format-error/31371>\
**Category:** Ignition\
**Created:** [January 17, 2020, 4:37pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371 "2020-01-17T16:37:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 17, 2020, 4:37pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/1 "2020-01-17T16:37:14Z")

</div>

I found something Strange,

I have a date Mon Dec 30 00:00:00 CST 2019

when I tried converting this to `system.date.format(date,"YYYY-MM-dd")'` it gave me

```auto
2020-12-30

```

Here,

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/534ea858ccbc5b38b5e216132665a8f2911471b7.png)

The year is completely different !

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 17, 2020, 4:50pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/2 "2020-01-17T16:50:05Z")

</div>



---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [January 17, 2020, 4:54pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/3 "2020-01-17T16:54:06Z")

</div>

YYYY is “week year”, which is almost never what you want.  
You need yyyy.  
(See Paul’s video for why, or [this SO question](https://stackoverflow.com/questions/34691582/how-does-java-week-year-really-work).)

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 17, 2020, 4:56pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/4 "2020-01-17T16:56:17Z")

</div>

wow, sometime you feel you’re smart but then someone comes in and tells you how dumb you’re !! Thanks so much

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 17, 2020, 5:00pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/5 "2020-01-17T17:00:48Z")

</div>

> [@kaushik.shah](#):
>
> you feel you’re smart but then

Some of us greybeards have been round and round with that. You get used to it. /:

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [January 17, 2020, 5:14pm UTC](https://forum.inductiveautomation.com/t/system-date-format-error/31371/6 "2020-01-17T17:14:53Z")

</div>

Like Phil said.

The only reason I know that one is because I’ve been bitten by it. More than once. In fact, way too many times. 😳
