# Unparsable Date

**URL:** <https://forum.inductiveautomation.com/t/unparsable-date/53283>\
**Category:** Ignition\
**Tags:** ignition79, vision, scripting\
**Created:** [November 19, 2021, 11:19am UTC](https://forum.inductiveautomation.com/t/unparsable-date/53283 "2021-11-19T11:19:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnaik](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nnaik](https://forum.inductiveautomation.com/u/nnaik)\
**Post date:** [November 19, 2021, 11:19am UTC](https://forum.inductiveautomation.com/t/unparsable-date/53283/1 "2021-11-19T11:19:44Z")

</div>

Hello everybody,  
I am facing an issue parsing a string date to date format using below code:

```auto
url"https://somewebsite.com"
token = 'some token'
headers = {'Accept': 'application/json','Authorization': token}
bypassCertValidation = True
source = system.net.httpGet(url,headerValues=headers,bypassCertValidation = True)
noaaJSON = system.util.jsonDecode(source)
#print noaaJSON
siteID = noaaJSON['result'][0]['siteId']
pollTime = str(noaaJSON['result'][0]['pollTime'])
print siteID
print pollTime
Date = system.date.parse(pollTime,"yyyy-MM-dd'T'HH:mm:ss.SSSZ")
print Date

```

* * *

Error code:

```auto
WWEF
2021-11-19T11:12:43.527Z ------ **This is the String date result trying to parse**

16:42:52.046 [AWT-EventQueue-0] ERROR com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter - <HTML>Error executing script for event:&nbsp;<code><b>actionPerformed</b></code><BR>on component:&nbsp;<code><b>Button 3</b></code>.
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last):
  File "<event:actionPerformed>", line 12, in <module>
	at java.base/java.text.DateFormat.parse(Unknown Source)

	at com.inductiveautomation.ignition.common.script.builtin.DateUtilities.parse(DateUtilities.java:437)

	at jdk.internal.reflect.GeneratedMethodAccessor382.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.text.ParseException: java.text.ParseException: Unparseable date: "2021-11-19T11:12:43.527Z"

	at org.python.core.Py.JavaError(Py.java:495)
	at org.python.core.Py.JavaError(Py.java:488)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:204)
	at org.python.core.PyObject. __call__ (PyObject.java:404)
	at org.python.core.PyObject. __call__ (PyObject.java:408)
	at org.python.pycode._pyx334.f$0(<event:actionPerformed>:14)
	at org.python.pycode._pyx334.call_function(<event:actionPerformed>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1275)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:636)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:193)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:284)
	at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
	at com.sun.proxy.$Proxy37.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.python.core.PyException: Traceback (most recent call last):
  File "<event:actionPerformed>", line 12, in <module>
	at java.base/java.text.DateFormat.parse(Unknown Source)

	at com.inductiveautomation.ignition.common.script.builtin.DateUtilities.parse(DateUtilities.java:437)

	at jdk.internal.reflect.GeneratedMethodAccessor382.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.text.ParseException: java.text.ParseException: Unparseable date: "2021-11-19T11:12:43.527Z"

	... 52 common frames omitted
Caused by: java.text.ParseException: Unparseable date: "2021-11-19T11:12:43.527Z"
	at java.base/java.text.DateFormat.parse(Unknown Source)
	at com.inductiveautomation.ignition.common.script.builtin.DateUtilities.parse(DateUtilities.java:437)
	at jdk.internal.reflect.GeneratedMethodAccessor382.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:186)
	... 49 common frames omitted

```

Thanks for Help 🙂

---

<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:** [November 19, 2021, 12:47pm UTC](https://forum.inductiveautomation.com/t/unparsable-date/53283/2 "2021-11-19T12:47:19Z")

</div>

It probably doesnt recognize the Z try this:

`Date = system.date.parse(pollTime,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")`

if you want it with the timezone use X, tho im guessing you wont need this

`system.date.parse(pollTime,"yyyy-MM-dd'T'HH:mm:ss.SSSX")`  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/0/80b7276ec1cc52dfd822627443cdf90af8ea59db.png)
