# Script function: system.tag.storeTagHistory Timestamp format

**URL:** <https://forum.inductiveautomation.com/t/script-function-system-tag-storetaghistory-timestamp-format/12533>\
**Category:** Ignition\
**Created:** [January 9, 2017, 3:48pm UTC](https://forum.inductiveautomation.com/t/script-function-system-tag-storetaghistory-timestamp-format/12533 "2017-01-09T15:48:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajdewhirst](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@ajdewhirst](https://forum.inductiveautomation.com/u/ajdewhirst)\
**Post date:** [January 9, 2017, 3:48pm UTC](https://forum.inductiveautomation.com/t/script-function-system-tag-storetaghistory-timestamp-format/12533/1 "2017-01-09T15:48:00Z")

</div>

I’m trying to use system.tag.storeTagHistory to write historical samples directly into the history database.

If I leave the “Timestamp” argument blank, it writes the timestamp in the database as now, in the “milliseconds since 1970” format.

If I add a Timestamp argument value in the function using the same timestamp format, I get an error. I have tried multiple standard timestamp formats for the argument and I can’t seem to get the function to execute.

What format for the Timestamp argument does the function expect?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 13, 2017, 6:24pm UTC](https://forum.inductiveautomation.com/t/script-function-system-tag-storetaghistory-timestamp-format/12533/2 "2017-01-13T18:24:33Z")

</div>

The storeTagHistory function expects an array (in Jython terms, a list) of Date objects. system.date.now() returns a date object (which, technically, represents a date and time). To create an arbitrary Date object, you can use the system.date.\* functions:

`date = system.date.getDate(2018, 6, 29) #year, month (0 indexed!), day
date = system.date.setTime(date, 1, 37, 44) #hours, minutes, seconds`

Then, you use that inside the storeTagHistory function you would have to wrap it in a list:

```auto
system.tag.storeTagHistory(<other arguments skipped>, [date])
```

The square brackets are the critical part.

---

<div class="post-metadata">

**Author:** ![ajdewhirst](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@ajdewhirst](https://forum.inductiveautomation.com/u/ajdewhirst)\
**Post date:** [January 16, 2017, 4:21pm UTC](https://forum.inductiveautomation.com/t/script-function-system-tag-storetaghistory-timestamp-format/12533/3 "2017-01-16T16:21:50Z")

</div>

Thank you!

I think I was trying to pass it a list of strings, so I’ll need to convert the strings to date objects then list those. I’ll try that.

Thanks.
