How to Show Time (Duration, not DateTime)

Building a project in Edge 7.9.13.
I have a table that I am using a script to fill in the Dataset from tags, The tags are from an array of UDTs in the PLC. Everything is working except one column.
In the PLC I am using 64 bit integers for the timestamps (UTC time in milliseconds.).
I have a start time, a stop time, and a duration time (stop-start in PLC). This is also a 64 bit integer.
When I display these in my table, the start and stop work fine, but the duration is off.
It looks to be off by the timezone offset. It there a way I can read this as just time and not datetime?

The tags in the PLC look like this:

If Ignition knows the Start and Stop time why not let it calculate the duration instead of converting the value in the plc?

The value is also needed else where in the PLC. But I’m not against calculating it in ignition also if it gives me the right format. hh:mm:ss

If you have the duration as miliseconds, just add it to a fixed date, and format it as a date., 01, 01), {duration})

If you use the fromMillis function, you’ll likely get into trouble with the time zone differences, as that’s always interpreted as UTC. While getDate will give you the midnight of a date in the current timezone.

EDIT: sorry, didn’t notice this was scripting instead of expressions. Same principle should hold in python though, start from midnight in the current timezone, and add milliseconds to it.

From a script written long ago, on a PC far, far away…

# convert an integer value to a duration in h:m:s
def hms(typeIn, value):
  import datetime
  if typeIn=='min':
    return str(datetime.timedelta(minutes=value))
  if typeIn=='sec':
      return str(datetime.timedelta(seconds=value))
  if typeIn=='millis':
  	return str(datetime.timedelta(milliseconds=value))
valueIn = 110002

print hms('millis', valueIn)


Thank for Force for that one. That gives me what I’m looking for.