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

C# 单声道错误格式异常,但不在windows上,c#,.net,datetime,mono,formatexception,C#,.net,Datetime,Mono,Formatexception,为什么我在Mono上而不是Windows上出现此错误 未处理的异常:System.FormatException:无效的格式字符串 位于System.DateTime.ParseExact(字符串,字符串[],System.IFormatProvider,System.Glo balization.DateTimeStyles) 位于System.DateTime.ParseExact(字符串、字符串、System.IFormatProvider、System.Globalization.Dat

为什么我在Mono上而不是Windows上出现此错误

未处理的异常:System.FormatException:无效的格式字符串
位于System.DateTime.ParseExact(字符串,字符串[],System.IFormatProvider,System.Glo balization.DateTimeStyles)
位于System.DateTime.ParseExact(字符串、字符串、System.IFormatProvider、System.Globalization.DateTimeStyles)
在System.DateTime.ParseExact(字符串,字符串,System.IFormatProvider)
at(包装器动态方法)object.CallSite.Target(System.Runtime.CompilerServices.Close,System.Runtime.CompilerServices.CallSite,System.Type,object,string,S System.Globalization.DateTimeFormatInfo)
位于System.Dynamic.UpdateDelegates.UpdateAndExecute4(System.Runtime.CompilerServices.CallSite、System.Type、object、string、System.Globalization.DateTimeFormatInfo)<0x00418>
在TwitterScraper.Program.scrapeTwitter()上
位于TwitterScraper.Program.Main(字符串[])
在这里使用此代码

DateTime tweettime=DateTime.ParseExact(obj[“created_at”].ToString(),
“ddd-MMM-dd-HH:mm:ss%K yyyy”,
CultureInfo.InvariantCulture.DateTimeFormat);
这是用来处理Twitter给你的时间格式。

试试这个:

DateTimeOffset tweettime = DateTimeOffset.ParseExact(yourInputString,
    "ddd MMM dd HH:mm:ss zzz yyyy", CultureInfo.InvariantCulture);