C# DateTime的使用,求教!!

我的数据表格中有一列时间为18:28:06,然后我用string类型读取时间,我想将该string放入DateTime类型的变量中,请问需要怎样做?
我的代码是:DateTime dt=Convert.ToDateTime(time)
time是string类型。
但这样做不对,求教!!谢谢!!

时间是的格为:yyyy-mm-dd mm:ss 但你的只有时分秒,肯定不能用datetime,只有在前面加上日期,如time=“2016-03-09 18:28:06 ”
这样再去Convert.ToDateTime(time)

2001530605,2015-04-20,18:28:06
数据表格的一行示例如上。

代码为:
string time=str[1]+""+str[2];//str[1]为2015-04-20,str[2]为18:28:06
ps.time =Convert.ToDateTime(time);//ps.time是DateTime类型的变量

请问这样的代码哪里有错啊?
谢谢!

你去找到DateTime的定义

 // 摘要:
        //     将日期和时间的指定字符串表示形式转换为等效的日期和时间值。
        //
        // 参数:
        //   value:
        //     日期和时间的字符串表示形式。
        //
        // 返回结果:
        //     value 的值的日期和时间等效项,如果 value 为 null,则为 System.DateTime.MinValue 的日期和时间等效项。
        //
        // 异常:
        //   System.FormatException:
        //     value 不是格式正确的日期和时间字符串。
        public static DateTime ToDateTime(string value);

去网上看到标准的日期和事件字符串表示是2009-06-15T13:45:30这种形式的,亲测可用。

string time=str[1]+" "+str[2];// ""中间需要加入空格