c# 怎么将1003 062121328 装换成 20231003 062121
可以使用DateTime.ParseExact方法将字符串解析为DateTime类型,再使用ToString方法将其转换为指定格式的字符串。
以下是示例代码:
string input = "10/03 06:21:21:328";
DateTime datetime = DateTime.ParseExact(input, "MM/dd HH:mm:ss:fff", null);
string output = datetime.ToString("yyyy/MM/dd HH:mm:ss");
Console.WriteLine(output); // 输出:2023/10/03 06:21:21
原文地址: http://www.cveoy.top/t/topic/huoW 著作权归作者所有。请勿转载和采集!