I have to believe that someone has already figured this out, but I am a little bit stumped.
I am using WebVisu, and I want to display a time stamp from the Controller on a WebVisu screen. The time stamp in the controller is UTC, but I need to display this time as the local time, based on the timezone on the user's PC.
How do I do this? I am using Codesys 3.5 SP 15.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the Oscat Basic library there is a function block called UTC_TO_LTIME that should be what you're looking for. It does allow for daylight savings time changes so you'll need to know if for a given timestamp if DST is active. Also in Oscat Basic is another function block called DST that will check for a given UTC if DST is active. It seems mislabelled in the documentation I have as DT2_TO_SDT.
I have to believe that someone has already figured this out, but I am a little bit stumped.
I am using WebVisu, and I want to display a time stamp from the Controller on a WebVisu screen. The time stamp in the controller is UTC, but I need to display this time as the local time, based on the timezone on the user's PC.
How do I do this? I am using Codesys 3.5 SP 15.
In the Oscat Basic library there is a function block called UTC_TO_LTIME that should be what you're looking for. It does allow for daylight savings time changes so you'll need to know if for a given timestamp if DST is active. Also in Oscat Basic is another function block called DST that will check for a given UTC if DST is active. It seems mislabelled in the documentation I have as DT2_TO_SDT.
Oscat Basic
https://store.codesys.com/oscat-basic.html
Documentation
http://www.oscat.de/images/OSCATBasic/oscat_basic333_en.pdf
Last edit: Morberis 2020-07-08