I experiance some difficulties with date time presentation in ignition designer.
I have a date in PGSQL, it’s stored as a floatvalue. I have made a query to convert to yyyy-mm-dd-ww and I get the desigred result as an output.
SELECT floatvalue as number
,cast(floatvalue as integer) / 65536 & 65535 as year
,cast(floatvalue as integer) / 4096 & 15 as month
,cast(floatvalue as integer) / 16 & 255 as day
,cast(floatvalue as integer) / 1 & 15 as w
FROM public.v_sqlt_data_1_2020_03 where tagid=150;
- My tagid value = 132428004
- The machine expected datatype = YYYYYYYYYYYYYYYYMMMMDDDDDDDDWWWW (I know, it’s weird)
- The source is an OPC tag that I log historical (I have some difficulties doing a direct conversion on the tag)
Now when I make a query tag, and I run this query and set the tag datatype as DateTime, I get Jan-02-1970. My result in PGSQL = 2020-11-14-4
When I use the same approach for my service interval countdown timer, my query tag does work fine, however that tag is time (seconds)
Does anybody have any suggestions how I can either do it better, or what I am doing wrong.
Jarno van den Berg