Answer the question
In order to leave comments, you need to log in
How to make several hours on the page of different countries?
There is such a task: to make several clocks of different countries in the landing, I don’t have enough knowledge in JS to understand how I can get the time of each country.
Time still has to tick every minute, but this is not a problem, the problem is getting the correct time for each country. The site will be visited from different cities, and maybe countries, so you need to somehow independently receive each time of the country.
Answer the question
In order to leave comments, you need to log in
var a = new Date().getHours() + new Date().getTimezoneOffset() / 60; // 0 часовой пояс
var b = a + 3; // 3 изменить на нужный часовой пояс
new Date(new Date().setHours(b));
it is easier to display the server time and the time of a specific visitor
We go to Yandex.Time https://yandex.ru/time
We create the necessary widgets
We select "Informer to the site" in the settings
We get a code like this:
<iframe frameborder="no" scrolling="no" width="150" height="280" src="https://yandex.ru/time/widget/?geoid=10115&lang=ru&layout=vert&type=digital&face=digits"></iframe>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question