Page 1 of 1

Scripting for Time string to Seconds

Posted: Thu Jul 12, 2018 1:30 pm
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 ?

Re: Scripting for Time string to Seconds

Posted: Wed Feb 06, 2019 8:03 am
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.