System Function <system.date.parse> treats the input time as UTC?

Hi,

I am using a Status Chart.
When the mouse hovers on the Chart and I captured the timestamp as a big integer, so I converted it to the datetime as follows.

SelectedTime1 = datetime.datetime.fromtimestamp(selectedTimeStamp)

I have verified the timestamp and it works.

I then converted it to SelectedTime2 through the system function - system.date.parse
SelectedTime2 = system.date.parse(SelectedTime1,“yyyy-MM-dd HH:mm:ss”)

However, I checked the data. I have found that SelectedTime1 and SelectedTime2 have 4 hours of difference. I think the system.date.parse treats the SelectedTime1 as a UTC time and convert it into Eastern Time.

e.g. This is my results
SelectedTime1: 2021-05-12 03:41:07.549000 SelectedTime2: Tue May 11 23:41:07 EDT 2021
The server is running at the Eastern Time Zone.

What I want is
SelectedTime1: 2021-05-12 03:41:07.549000 SelectedTime2: Tue May 12 03:41:07 EDT 2021

How can I force the function system.date.parse not to treat the SelectedTime1 as UTC time, instead use it as Local Time ? Or is there any ways I can use to resolve this issue.

Sorry… I am new to the ignition. Please help. Thanks.

Simon

What do you get if you use

selectedTime  =  system.date.fromMillis(long(selectedTimeStamp*1000))
2 Likes

Hi Jordan,

It works… Thanks so much for your help.

Simon

1 Like