To convert the string "2023-06-28 23:57:00" to a DateTime object in C#, you can use the DateTime.ParseExact method with the specified format:

string dateString = "2023-06-28 23:57:00";
DateTime dateTime = DateTime.ParseExact(dateString, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);

This will convert the string to a DateTime object with the format "2023-06-28 23:57:00".

c# 2023-06-28 235700 装换成 datetime 2023-06-28

原文地址: https://www.cveoy.top/t/topic/hY4n 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录