system.tag.storeTagHistory not able to store Timestamp as Required

Hi,
I have tags for that historian is enabled and I want to write value with timestamp using system.tag.storeTagHistory, by using this value is storing in the database but timestamp is storing with current date & time and not the date time which I am provided from strtime.

system.tag.storeTagHistory("SQL_Connection", "Test_Tag_Provider",["[Test_Tag_Provider]Test/Recipe1"], [Recipe1]],[strTime])

I want to write Recipe1 tag with Reipe1 value with timestamp as strTime that will be passed.

I believe the table for storing data in the database uses a big Int data type for the timestamp value, you won't be able to store it as a string value there

Hi,
I had converted the string to date format using
datetime1 = system.date.parse(strTime, "yyyy-MM-dd HH:mm:ss" )

system.tag.storeTagHistory("SQL_Connection", "Test_Tag_Provider",["[Test_Tag_Provider]Test/Recipe1"], [Recipe1]],[datetime1])

But I am getting the error as
java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value 'Mon Jul 10 12:19:12 IST 2023' into type: class java.lang.Integer

from java.text import SimpleDateFormat
Its worked

Thanks Hayden

You should also be able to get it this way:

datetime1 = system.date.parse(strTime, "yyyy-MM-dd HH:mm:ss" ).time

By adding .time to the end, it will provide the date to millis which is a long integer datatype.