# system.tag.storeTagHistory Cannot coerce value into date

**URL:** <https://forum.inductiveautomation.com/t/system-tag-storetaghistory-cannot-coerce-value-into-date/12792>\
**Category:** Ignition\
**Created:** [March 15, 2017, 1:57pm UTC](https://forum.inductiveautomation.com/t/system-tag-storetaghistory-cannot-coerce-value-into-date/12792 "2017-03-15T13:57:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 15, 2017, 1:57pm UTC](https://forum.inductiveautomation.com/t/system-tag-storetaghistory-cannot-coerce-value-into-date/12792/1 "2017-03-15T13:57:18Z")

</div>

I'm using the [system.tag.storeTagHistory](https://docs.inductiveautomation.com:8443/display/DOC/system.tag.storeTagHistory) example at the bottom of the page. I can get it to work when I let it insert the current time. I want to insert a time value I'm reading from a CSV file.

[code]import datetime

histProv = "hp\_Energy"  
tagProv = "tp\_Energy"  
paths = ["EnergyMeters/Board A/MA-44-Test/\_kWh"]  
values = [15]  
q = 192

# The following line inserts the value with current time. It works.

system.tag.storeTagHistory(histProv, tagProv, paths, values)

#If we try to specify the time (as below) we get an error ...  
date = system.date.getDate(2017, 2, 15)  
histDate = system.date.setTime(date, 15, 04, 44)  
system.tag.storeTagHistory(histProv, tagProv, paths, values, q, histDate)[/code]  
Error message is:

> [@](#):
>
> GatewayException: Cannot coerce value 'Thu Mar 16 03:04:44 GMT 2017' into type: class [L]java.util.Date;

What am I doing wrong?

---

<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:** [March 15, 2017, 2:23pm UTC](https://forum.inductiveautomation.com/t/system-tag-storetaghistory-cannot-coerce-value-into-date/12792/2 "2017-03-15T14:23:51Z")

</div>

Your quality and timestamp need to be lists.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 15, 2017, 3:15pm UTC](https://forum.inductiveautomation.com/t/system-tag-storetaghistory-cannot-coerce-value-into-date/12792/3 "2017-03-15T15:15:41Z")

</div>

Thanks, Kathy. That seems to work.

For anyone else …

[code]import datetime

histProv = “hp\_Energy”  
tagProv = “tp\_Energy”  
paths = [“EnergyMeters/Board A/MA-44-Test/\_kWh”]  
values = [15]  
q = [192]

# The following line inserts the value with current time. It works.

system.tag.storeTagHistory(histProv, tagProv, paths, values)

#If we try to specify the time (as below) we get an error …  
date = system.date.getDate(2017, 2, 15)  
histDate = [system.date.setTime(date, 15, 13, 44)]  
system.tag.storeTagHistory(histProv, tagProv, paths, values, q, histDate)[/code]
