none
Get TimeZone from Google API RRS feed

  • Question

  • Hi,

    I am getting below result from Google API.

    {
       "dstOffset" : 0,
       "rawOffset" : 14400,
       "status" : "OK",
       "timeZoneId" : "Asia/Dubai",
       "timeZoneName" : "Gulf Standard Time"
    }

    How can I convert this output to +4 GMT?

    Thanks,

    Jassim

    Sunday, May 20, 2018 12:05 PM

Answers

All replies

  • 14400 seconds / 3600 = 4 hours
    • Marked as answer by Jassim Rahma Sunday, May 20, 2018 4:39 PM
    Sunday, May 20, 2018 12:44 PM
  • Great. Thanks

    One more question please.

    \How can I get the timestamp which n needs to be passed in the URL?

    it says:

    timestamp specifies the desired time as seconds since midnight, January 1, 1970 UTC. The Time Zone API uses the timestamp to determine whether or not Daylight Savings should be applied, based on the time zone of the location. Note that the API does not take historical time zones into account. That is, if you specify a past timestamp, the API does not take into account the possibility that the location was previously in a different time zone.

    but how can I calculate this in C#?

    Sunday, May 20, 2018 2:59 PM
  • I did this:

    DateTime epochDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
    TimeSpan ts = DateTime.UtcNow - epochDate;
    
    string timestamp = ts.TotalSeconds.ToString();
    

    Thanks

    Sunday, May 20, 2018 4:39 PM