string s = "20160822 9:56"; string dt = DateTime.ParseExact(s, "yyyyMMdd H:mm", null).ToString("yyyy-MM-dd H:mm"); Response.Write(dt);