首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >单声道错误格式异常,但不在windows上

单声道错误格式异常,但不在windows上
EN

Stack Overflow用户
提问于 2013-03-21 06:02:16
回答 1查看 909关注 0票数 2

为什么我在Mono上得到了这个错误,但在Windows上却没有?

代码语言:javascript
复制
Unhandled Exception: System.FormatException: Invalid format string
at System.DateTime.ParseExact (string,string[],System.IFormatProvider,System.Glo                                                                                                          balization.DateTimeStyles) <0x00127>
at System.DateTime.ParseExact (string,string,System.IFormatProvider,System.Globa                                                                                            lization.DateTimeStyles) <0x0004f>
at System.DateTime.ParseExact (string,string,System.IFormatProvider) <0x0001f>
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServi                                                                                        ces.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object,string,S                                                                                        ystem.Globalization.DateTimeFormatInfo) <0x000f3>
at System.Dynamic.UpdateDelegates.UpdateAndExecute4<System.Type, object, string,                                                                                         System.Globalization.DateTimeFormatInfo, object> (System.Runtime.CompilerServic                                                                                            es.CallSite,System.Type,object,string,System.Globalization.DateTimeFormatInfo) <                                                                                                0x00418>
at TwitterScraper.Program.scrapeTwitter () <0x00a22>
at TwitterScraper.Program.Main (string[]) <0x000bf>

在这里使用以下代码

代码语言:javascript
复制
DateTime tweettime = DateTime.ParseExact(obj["created_at"].ToString(),
        "ddd MMM dd HH:mm:ss %K yyyy",
        CultureInfo.InvariantCulture.DateTimeFormat);

这是用来处理Twitter给你的时间格式的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-19 22:04:33

试着这样做:

代码语言:javascript
复制
DateTimeOffset tweettime = DateTimeOffset.ParseExact(yourInputString,
    "ddd MMM dd HH:mm:ss zzz yyyy", CultureInfo.InvariantCulture);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15535634

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档