gpt4 book ai didi

c# - 单声道错误格式异常但不是在 Windows 上

转载 作者:太空宇宙 更新时间:2023-11-03 13:45:25 24 4
gpt4 key购买 nike

我在 Mono 而不是在 Windows 上收到此错误的任何原因?

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>

在这里使用这段代码

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);

关于c# - 单声道错误格式异常但不是在 Windows 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15535634/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com