Opc.Ua.JsonDecoder.ReadDateTime C# (CSharp) Method

ReadDateTime() public method

Reads a UTC date/time from the stream.
public ReadDateTime ( string fieldName ) : System.DateTime
fieldName string
return System.DateTime
        public DateTime ReadDateTime(string fieldName)
        {
            object token = null;

            if (!ReadField(fieldName, out token))
            {
                return DateTime.MinValue;
            }

            var value = token as DateTime?;

            if (value != null)
            {
                return value.Value;
            }

            var text = token as string;

            if (text != null)
            {
                return XmlConvert.ToDateTime(text, XmlDateTimeSerializationMode.Utc);
            }

            return DateTime.MinValue;
        }