Microsoft.Protocols.TestSuites.Common.Common.GetNoSeparatorDateTime C# (CSharp) 메소드

GetNoSeparatorDateTime() 공개 정적인 메소드

Try to parse the no separator time string to DateTime
public static GetNoSeparatorDateTime ( string time ) : System.DateTime
time string The specified DateTime string
리턴 System.DateTime
        public static DateTime GetNoSeparatorDateTime(string time)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append(time.Substring(0, 4));
            stringBuilder.Append("-");
            stringBuilder.Append(time.Substring(4, 2));
            stringBuilder.Append("-");
            stringBuilder.Append(time.Substring(6, 5));
            stringBuilder.Append(":");
            stringBuilder.Append(time.Substring(11, 2));
            stringBuilder.Append(":");
            stringBuilder.Append(time.Substring(13));

            DateTime dateTime = DateTime.Parse(stringBuilder.ToString());
            return dateTime;
        }
Common