1

Here Google Maps Time Zone API get local time in UTC is good question and good answer about I want. However, here is a problem. Sample above allows to know dstOffset and rawOffset by location and timestump UTC. Well. I know my location and local timestump. I want to know UTC time. But UTC time can be know only by dstOffset and rawOffset. So, for obtain dstOffset and rawOffset is necessary know them before.

Where is my error, please?

Community
  • 1
  • 1
Meta
  • 11
  • 2

1 Answers1

2

... get local time in UTC is good question and good answer...

No, that is actually not a good question. "local time in UTC" is nonsensical. A time value can either be in UTC, or it can be local. They might be equivalent if your local time happens to be aligned to UTC+00:00, but they are generally considered two different things.

... I want to know UTC time.

All languages and platforms have APIs for retrieving the current UTC time. UTC is the same for everyone on the planet at all times. You do not need to make a call to an external API to determine this. All that matters is that your computer's clock is synchronized to an external time source.

... But UTC time can be know only by dstOffset and rawOffset. So, for obtain dstOffset and rawOffset is necessary know them before.

That is incorrect. You do not need to know anything about your local time zone to determine the current UTC time. All modern operating systems keep track of track time in UTC. They convert to local time when needed, such as to display the local clock to the end user.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • Dear Matt. Thanks. How can be obtain UTC timestump by local timestump and location? – Meta Jun 08 '16 at 22:26
  • @Meta - Please read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). You've given no details at all - such as language, timestamp format, examples, etc. Also, it's bad form to ask a different question in a comment. If you search, you'll find most of these questions have already been answered. – Matt Johnson-Pint Jun 08 '16 at 22:56