Bug- Time to UDINT

Hi, I am trying to convert time to udint. It worked perfectly with PC Worx but on plcnext engineer I am getting an error that the conversion is not supported. Is there any other way to convert time to int?

Hello, I can’t say why that works in PC WORX, but it makes sense that this isn’t allowed in PLCnext Engineer. The TIME type is a 32-bit signed integer, so trying to convert this to an unsigned 32-bit integer will lose all the negative values. Instead, you can use the TO_DINT function, which works OK for me with a TIME value. ~ Martin.

Hi Martin, Thank you for your quick response. A long time ago I have found somewhere that I should be using udint to convert time, and I have been using it without problems ever since. I have tried it now with dint and it is working. Thank you again.