.net - 如何将Twitter时间戳转换为DateTime?

标签 .net wpf c#-4.0 twitter

我已经在谷歌上搜索了一段时间,但是我找不到解决问题的答案。

我正在使用C#和Windows Presentation Foundation制作一个Twitter客户端,但我不知道如何将Twitter提供的时间戳更改为DateTime或UNIX时间戳。

我知道Regex有可能,但我从未找到解决方案。

有一些我不知道的简便方法吗?我尝试从中转换的Twitter时间戳格式如下:

Fri Feb 11 23:45:15 +0000 2011

有任何想法吗?

最佳答案

基于sample elsewhere,如何使用ParseExact method:

const string format = "ddd MMM dd HH:mm:ss zzzz yyyy";
my_date = DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture);

关于.net - 如何将Twitter时间戳转换为DateTime?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4975236/

相关文章:

.net - Html Agility Pack 不匹配 <link> 标签

.net - System.StackOverflowException 发生与链接到 Html

wpf - 为什么我不能在菜单中为超过 1 个项目使用相同的图标?

visual-studio - Visual Studio生成调试配置,但不发布配置

c# - 如何在 C# 中使用 iTextSharp 获取 pdf 文件中的特定段落?

c# - Linq: GroupBy 其 child.value 属性值

c# - 如果调用 Response.Close(),文件下载将被截断

c# - WPF 数据网格 : How do I access a ComboBox in a specific row of a DataGridTemplateColumn?

c#/wpf ResourceDictionary.DeferrableContent 异常

c# - 仅在 safari 浏览器中,ASP.net MVC 中的 IFrame 中的 session 为空