Joe*_*orn 12
假设您已将其作为日期时间:
DateTime dt = DateTime.Today;
dt.ToString("yyyyMMdd");
Run Code Online (Sandbox Code Playgroud)
如果你有一个en-US日期时间字符串,你可以像这样解析它:
DateTime dt = DateTime.ParseExact("07/22/2009", "MM/dd/yyyy", CultureInfo.GetCultureInfo("en-US"));
Run Code Online (Sandbox Code Playgroud)
请参阅有关标准和自定义 DateTime格式字符串的MSDN部分.