Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何解析从 Linux 环境中的 WebSphere 接收的 c# DateTime 对象中的以下日期时间字符串。
string serverDate = "Sat Nov 03 13:03:13 GMT+05:30 2012"
尝试这个:
string serverDate = "Sat Nov 03 13:03:13 GMT+05:30 2012"; var date = DateTime.ParseExact(serverDate, @"ddd MMM dd HH:mm:ss \G\M\TK yyyy", CultureInfo.InvariantCulture);
请注意我是如何分别转义每个“GMT”字符的。