Google Time Zone API - Timestamp Setting

In my client application, I have latitude and longitude information from the skyhook API based on its IP

Now, based on the information about latitude and longitude, I need to find out information about the client’s time zone. But in the timezone API API documentation https://developers.google.com/maps/documentation/timezone/ I see that the timestamp is required. In this case, what should I do.

Also can you help me understand what the timestamp is? For example, for example: - if my application server is located in USA (for example, in the PST time zone), and it calls the Google API call to transfer the server’s timestamp.

If a user logs into a client application from India by passing lat / long information to the application server to get time zone information, what information will the API provide like dstOffset and rawOffset? ie If I add a server timestamp with dstOffset and rawOffset, will I get the time zone of the client machine?

+9
timezone timestamp timestamp-with-timezone
source share
3 answers

I scratch my head several times over the Google timezone API for several minutes, particularly in the timestamp parameter. This may require:

In San Diego, we (now, in August) have a GMT offset of -8 due to daylight saving time. However, in November we will have a GMT -7 offset .

So which gmt offset should Google return? -7 or -8? They are both valid, but it depends on which day you take the measurement.

Enter a timestamp argument. By starting the service now and using the timestamp value of August 2015 , I get this answer:

{ "dstOffset" : 3600, "rawOffset" : -28800, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Daylight Time" } 

But if I remove the mark before November 2015 (as soon as San Diego reaches its daily savings, I end up with this):

 { "dstOffset" : 0, "rawOffset" : -28800, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Standard Time" } 

In both cases, rawOffset is the same, but the DST has changed due to the timestamp I provided. If you just want to know the raw time zone, the timestamp doesn't matter.

But if you want the app to do something reliably at 8:00 in San Diego in August and at 8:00 in November in San Diego, you will need to use a timestamp.

In other words, what is the value of knowing that San Diego is usually 7 hours from GMT. If you work with time zones, you are probably trying to ensure that UTC time matches what a real person experiences in this place. Thus, the DST offset is critical.

+7
source share

The link in the documentation clearly states that the timestamp must be in UTC and that it is used to display the correct DST offset value. It will also control if the timeZoneName field timeZoneName displayed with the name "Standard" or "Daylight" in the title.

If you are not interested in this and just need the timeZoneId field, then it does not matter what value you pass.

+3
source share

Try this

 DateDiff("s", "1/1/1970", DateTime.Now) 
0
source share

All Articles