# T\_stamp appending error in python, unable to convert to type

**URL:** <https://forum.inductiveautomation.com/t/t-stamp-appending-error-in-python-unable-to-convert-to-type/65115>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 12, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/t-stamp-appending-error-in-python-unable-to-convert-to-type/65115 "2022-10-12T13:54:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [October 12, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/t-stamp-appending-error-in-python-unable-to-convert-to-type/65115/1 "2022-10-12T13:54:20Z")

</div>

I don't know why this didn't give me an issue last time, but this time I am getting an error.

```auto
currentTransaction= nextRow['t_stamp']
dataOut.append([currentTransaction, '', '','Totals','',hoursSum,str(uptimeSum),

```

* * *

If I try:

```auto
int(currentTransaction)

```

I get an error that is must be a number or string, not : `'2022-10-11 11:59:.003'`

* * *

I think last time, I had made a column in SQL using: `format( )`  
So my transaction column was a string?  
Now I have a legit timestamp that I am trying to append from a t\_stamp in SQL into a python dataset append.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 12, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/t-stamp-appending-error-in-python-unable-to-convert-to-type/65115/2 "2022-10-12T14:17:15Z")

</div>

Re-examine your assumptions. You are placing a timestamp in a variable whose name includes "transaction". That's more than a bit odd, and suggests that you are making a mistake at that line. Or you have crappy variable names that are confusing you.

In any case, timestamps that are instances of `java.util.Date` are not numbers, and therefore don't work with `int()`.

Show more of your current code.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [October 12, 2022, 2:18pm UTC](https://forum.inductiveautomation.com/t/t-stamp-appending-error-in-python-unable-to-convert-to-type/65115/3 "2022-10-12T14:18:30Z")

</div>

Thanks for your help.  
I just tried int() to see if I could get more data from the error codes.

The code is similar to this, except I am trying to use it for a different dataset.

> [@Help inserting rows of totals to a dataset from a query](https://forum.inductiveautomation.com/t/help-inserting-rows-of-totals-to-a-dataset-from-a-query/64498/12):
>
> Assuming your query will return something with ORDER BY Timestamp, Shift, Line to give data as in your original post. I would even go so far as to use just the date portion of Timestamp. Then, you are just looking for changes in either the date or the shift. sampleHeaders = ['Line', 'Shift', 'Hours', 'Gross', 'Net', 'Timestamp'] sampleData = [['K01', 1, 12, 200, 150, system.date.parse('2022-09-25', 'yyyy-MM-DD')], ['K02', 1, 12, 202, 152, system.date.parse('2022-09-25', 'yyyy-MM-D…

* * *

Is row 4 column 2 the 4th down and 2nd over, or does it count zeroes?

* * *

Ah, Okay, my issue was that I tried to pass a blank string to an integer on the shift column that expected an integer.  
The date worked.
