# \[NOT BUG, PEBKAC\] system.date.parse returning dodgy date for formats other than YYYY-MM-dd HH:mm:ss

**URL:** <https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352>\
**Category:** Ignition\
**Created:** [March 28, 2025, 8:15am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352 "2025-03-28T08:15:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 28, 2025, 8:15am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/1 "2025-03-28T08:15:53Z")

</div>

When using system.date.parse with formats other than the standard, it returns whatever dates it feels like, everything but what it should!

E.g.

```python
system.date.format(
	system.date.parse('20250312_120000', 'YYYYMMdd_HHmmss')
)
>>
u'2024-12-29 12:00:00' (or Sun Dec 29 12:00:00 ACDT 2024)

```

???

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 28, 2025, 8:17am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/2 "2025-03-28T08:17:42Z")

</div>

Ok nevermind... apparently "YYYY" should be "yyyy" 😵‍💫  
Java thinks Y is "Week Year" and y is Year... good job Java for being different....

First time using Ignition 🙂

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 28, 2025, 11:26am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/3 "2025-03-28T11:26:56Z")

</div>

Yep, I had used 'YYYY' for years before discovering it. We're usually on shutdown between Christmas and New Year's, so it was a self inflicted bug that didn't show itself for a very... long... time.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 28, 2025, 11:33am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/4 "2025-03-28T11:33:29Z")

</div>

It's funny, there are at least 4 different date format formats I've found so far in Ignition:

- Python, not that you should use its datetime objects (`%Y-%M` or something)
- Java (`yyyy-MM-dd HH:mm:ss` - lowercase y)
- Expression function dateFormat (`yyyy-MM-dd HH:mm:ss` - lowercase y, same as Java)
- SQL (ok, not really Ignition) (`YYYY-MM-dd HH:mm:ss` - normal)
- Perspective Tables (`YYYY-MM-DD HH:mm:ss` - DDs)

---

<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:** [March 28, 2025, 11:57am UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/5 "2025-03-28T11:57:58Z")

</div>

Also:

- Expression function `stringFormat("%tY-%<tm-%<td %<tH:%<tM:%<tS", someDateObj)`

or

- Expression function `stringFormat("%tF %<tT", someDateObj)`

( From `java.util.Formatter` )

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 28, 2025, 12:06pm UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/6 "2025-03-28T12:06:09Z")

</div>

😵

---

<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:** [March 28, 2025, 12:08pm UTC](https://forum.inductiveautomation.com/t/not-bug-pebkac-system-date-parse-returning-dodgy-date-for-formats-other-than-yyyy-mm-dd-hhss/104352/7 "2025-03-28T12:08:39Z")

</div>

I tend to use a variant of that last, because when formatting dates, you are usually also formatting other things. And those work in Ignition's logger's `.debugf()`, `.infof()` and similar methods.
