Twitter的转换日期时间为本地时间与UTC加上偏移时间为、日期、时间、Twitter

2023-09-06 14:02:41 作者:何必゛學會愛′

我开发一个Twitter的应用程序。由Twitter API返回的日期时间字符串格式周二01月24日8时42分31秒+0000 2012。该API还将返回的偏移值。对于(UTC + 05:30),钦奈,加尔各答,孟买,新德里,偏移值将是19800

I am developing a twitter app. The datetime string returned by twitter API is of format "Tue Jan 24 08:42:31 +0000 2012". The API will return the offset value also. For (UTC+05:30) Chennai, Kolkata, Mumbai, New Del the offset value will be "19800".

我将如何转换这个日期字符串本地日期时间与添加UTC偏移。

How will I convert this datetime string to local datetime with adding UTC offset.

任何人都可以请扔一些轻的呢?

Can anybody please throw some light on this?

推荐答案

偏移值存储在几秒钟内,你可以创建一个的DateTime 字符串你从Twitter收到并叫它方法 AddSeconds

Offset value is stored in seconds, you can just create a DateTime for string you received from Twitter and call it method AddSeconds