Scripting for Time string to Seconds

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
RobSel
Posts: 2
Joined: Thu Jul 12, 2018 1:23 pm

Scripting for Time string to Seconds

Post by RobSel »

I have tried to run this through several times and can get it working fine in simulated mode but never the HMI. I am currently using the X2 7 Pro.

Code: Select all

string time = Globals.Tags.Test1.Value;
Globals.Tags.Test.Value = Convert.ToInt32(TimeSpan.Parse(time).TotalSeconds);
And as i said before it works in the PC build and simulation but i get format exception with everything i have tried inside the HMI.
Anyone know a fix for this problem ?

liestol
Posts: 13
Joined: Thu Feb 11, 2016 5:11 am

Re: Scripting for Time string to Seconds

Post by liestol »

How is your string formatted (Test1)? I'm guessing this is different on the panel than on the development pc.

Try adding MessageBox.Show(test) so we can see exactly what we're dealing with.

Post Reply