# Illegal type for X value: class java.lang.String (column 'Date')

**URL:** <https://forum.inductiveautomation.com/t/illegal-type-for-x-value-class-java-lang-string-column-date/20124>\
**Category:** Ignition\
**Tags:** scripting, ignition79\
**Created:** [October 12, 2018, 2:52pm UTC](https://forum.inductiveautomation.com/t/illegal-type-for-x-value-class-java-lang-string-column-date/20124 "2018-10-12T14:52:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [October 13, 2018, 12:41pm UTC](https://forum.inductiveautomation.com/t/illegal-type-for-x-value-class-java-lang-string-column-date/20124/2 "2018-10-13T12:41:26Z")

</div>

You could use this code in a propertyChange script to convert your string to a date:

```auto
from java.text import SimpleDateFormat

# set the format of the date string
format = SimpleDateFormat("MM/dd/yyyy")

# get the raw data
ds = event.source.parent.RawData # This is your memory tag in a CustomProperty
ds2 = system.dataset.toPyDataSet(ds)

newRows = []
if len(ds2) > 0:
	# convert each row
	for row in ds2:
		dateStamp = format.parse(row[0])
		newRows.append([dateStamp, row[1]])
		
# create the new dataset
headers = ['Date', 'Value']
newDS = system.dataset.toDataSet(headers, newRows)

# write it to the Chart
event.source.parent.getComponent('Chart').Data = newDS

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/illegal-type-for-x-value-class-java-lang-string-column-date/20124)._
