# Parsing date throws an exception

**URL:** <https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349>\
**Category:** Ignition\
**Created:** [June 30, 2021, 9:41am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349 "2021-06-30T09:41:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlunapinel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mlunapinel/32/19719_2.png) [@mlunapinel](https://forum.inductiveautomation.com/u/mlunapinel)\
**Post date:** [June 30, 2021, 9:41am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/1 "2021-06-30T09:41:08Z")

</div>

Hello!

I’m having troubles parsing dates in Ignition scripting.

When I execute the following code:

```auto
print(system.date.now())

```

The output is:

```auto
Wed Jun 30 06:28:38 BRT 2021

```

The problem comes when I try to do the reverse operation, parsing this same string as a Date

```auto
date=system.date.parse('Wed May 05 08:11:59 BRT 2021')v

```

Throws

```auto
java.text.ParseException: java.text.ParseException: Unparseable date: "Wed May 05 08:11:59 BRT 2021"

```

What is causing this? Is it because this date is a ZonedDateTime?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 30, 2021, 11:19am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/2 "2021-06-30T11:19:57Z")

</div>

you should probably add in the second parameter for the format string

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 30, 2021, 11:24am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/3 "2021-06-30T11:24:42Z")

</div>

system.date.parse(‘Wed May 05 08:11:59 BRT 2021’, ‘E MMM dd HH:mm:ss z yyyy’ )

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/b/fb7ea65c31afe02ebcff4cd00aac02c1d4f2034b.png)

---

<div class="post-metadata">

**Author:** ![mlunapinel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mlunapinel/32/19719_2.png) [@mlunapinel](https://forum.inductiveautomation.com/u/mlunapinel)\
**Post date:** [June 30, 2021, 11:25am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/4 "2021-06-30T11:25:34Z")

</div>

Yes, I have tried multiple iterations of this parameter:

```auto
"EEE MM d kk:mm:ss zzz yyyy"

```

But nothing seems to be working. Any advice?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 30, 2021, 11:26am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/5 "2021-06-30T11:26:06Z")

</div>

> [@victordcq](#):
>
> E MMM dd HH:mm:ss z yyyy

I just wrote here above xd

---

<div class="post-metadata">

**Author:** ![mlunapinel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mlunapinel/32/19719_2.png) [@mlunapinel](https://forum.inductiveautomation.com/u/mlunapinel)\
**Post date:** [June 30, 2021, 11:27am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/6 "2021-06-30T11:27:15Z")

</div>

Yeah, it seems like we replied to each other at the same time 🙂 . Thank you so much, it worked!

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 30, 2021, 11:27am UTC](https://forum.inductiveautomation.com/t/parsing-date-throws-an-exception/48349/7 "2021-06-30T11:27:48Z")

</div>

np^^ mark my answer as solution if it did^^
