日期:2014-05-17 浏览次数:20479 次
string date = DateTime.Parse("2012-5-8").ToString("yyyy-MM-dd");//2012-05-08
------解决方案--------------------
CREATE TABLE #tableCol ( rq nchar(10) ) INSERT INTO #tableCol SELECT '2012-5-8' UNION ALL SELECT '2012-5-18' SELECT Convert(Varchar,CONVERT(datetime,rq,120),23) Timeformat FROM #tableCol /* Timeformat ------------------------------ 2012-05-08 2012-05-18 (2 行受影响) */