c#日期与字符格式互转(用于流水号)
class Program { static void Main(string[] args) { //将日期格式转为字符输出 string a = "CL" + DateTime.Now.ToString("yyyyMMddHHmmssms"); Console.WriteLine(a); //将字符格式转为字符输出 DateTime dt = DateTime.ParseExact("201910090914351435", "yyyyMMddHHmmssms", System.Globalization.CultureInfo.CurrentCulture); Console.WriteLine(dt); Console.ReadKey(); } }