Hello Everyone,
I'm new to programming .net in Wonderware System Platform and I'm having difficulty getting a .NET function to work. I'm trying to inialize a .NET structure to get the current date and time of the system that the Automated Object is running on. I can't seem to get it to verify and it keep giving me a error
"Date._ErrorReport:Script Date (Execute). Unknown Property:Today..."
What I'm trying to do is keep a common system date. These values will be written to a PLC clock so that the PLC clock is always sync'd to a common clock.
The code I wrote is below:
'//Start Code
DIM DOB as System.DateTime;
DOB = new System.DateTime;
Me.DateTime = System.DateTime.Today; 'Copy the date time to Me.Datetime
Me.DateTimeHour = System.DateTime.Hour;
Me.DateTimeMin = System.DateTime.Minute;
Me.DateTimeSec = System.DateTime.Second;
'//End Code
It looks like it doesn't like the System.DateTime.Today part of it but from the MSDN site it says the .Today is a property. Don't know what i'm doing wrong.
I'd like to try to keep this to .NET coding. I know within InTouch there is the $Month, $Day, $Year etc. but i'd like to not use those items and try to stick to .NET so I'm not passing values through InTouch and System Platform so much.
Any help would be appreciated...Thanks!
I'm new to programming .net in Wonderware System Platform and I'm having difficulty getting a .NET function to work. I'm trying to inialize a .NET structure to get the current date and time of the system that the Automated Object is running on. I can't seem to get it to verify and it keep giving me a error
"Date._ErrorReport:Script Date (Execute). Unknown Property:Today..."
What I'm trying to do is keep a common system date. These values will be written to a PLC clock so that the PLC clock is always sync'd to a common clock.
The code I wrote is below:
'//Start Code
DIM DOB as System.DateTime;
DOB = new System.DateTime;
Me.DateTime = System.DateTime.Today; 'Copy the date time to Me.Datetime
Me.DateTimeHour = System.DateTime.Hour;
Me.DateTimeMin = System.DateTime.Minute;
Me.DateTimeSec = System.DateTime.Second;
'//End Code
It looks like it doesn't like the System.DateTime.Today part of it but from the MSDN site it says the .Today is a property. Don't know what i'm doing wrong.
I'd like to try to keep this to .NET coding. I know within InTouch there is the $Month, $Day, $Year etc. but i'd like to not use those items and try to stick to .NET so I'm not passing values through InTouch and System Platform so much.
Any help would be appreciated...Thanks!