使用月份名称解析日期到C#DateTime [英] Parsing a Date with Month name to C# DateTime

查看:126
本文介绍了使用月份名称解析日期到C#DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解析下列日期格式到C#中的DateTime对象。

I want to parse the following date format to a DateTime object in C#.

"19 Aug 2010 17:48:35 GMT+00:00"

如何实现?

推荐答案

我建议使用 DateTime.ParseExact

I'd recommend using DateTime.ParseExact.

DateTime.ParseExact(dateString, "dd MMM yyyy H:mm:ss \\G\\M\\Tzzz", System.Globalization.CultureInfo.InvariantCulture);

这篇关于使用月份名称解析日期到C#DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆