Menu

GetPlcDateTime in C#

Jiri Marek
2016-08-29
2016-08-29
  • Jiri Marek

    Jiri Marek - 2016-08-29

    Hi guys,

    I have done several communication functions PC - S7-300, but I cant break function GetPlcDateTime. Do anybody have code example in C#?

    Thanks a lot!

     
  • Davide Nardella

    Davide Nardella - 2016-08-29
        private void button2_Click(object sender, EventArgs e)
        {
            DateTime DT = new DateTime() ;
            if (Client.GetPlcDateTime(ref DT)==0)
            {
                label15.Text = DT.ToLongDateString()+" - "+DT.ToLongTimeString();            
            }
    
        }
    

    Just tested into the C# CSClient example adding a button and a label.
    DT is the native .NET DateTime, after the call you can use it as you prefer in your code without further conversion

     
  • Jiri Marek

    Jiri Marek - 2016-08-29

    Thanks man.

     

Log in to post a comment.