Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Retrieving Twitter Server time

$
0
0
In my particular case, I am trying to calculate the difference in time (local vs. twitter). After giving it some thought, I ended up adding a second property that does just that.
public TimeSpan LocalToServerTimeOffset { get; set; }
...
                    if (_lastHeadersResult["Date"] != null)
                    {
                        DateTime serverTime;
                        if (DateTime.TryParse(_lastHeadersResult["Date"], out serverTime))
                        {
                            LocalToServerTimeOffset = DateTime.Now - serverTime;
                            ServerTime = serverTime;
                        }
                    }
I think others may find this property useful as well.

Cheers
_kurt

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>