Answer the question
In order to leave comments, you need to log in
How to determine today's date in Moscow?
How can I use js to determine the current date in Moscow?
Answer the question
In order to leave comments, you need to log in
function getDateInTimeZone(utcOffset, date = new Date()) {
const utcTime = date.getTime() + date.getTimezoneOffset() * 60000;
return new Date(utcTime + utcOffset * 3600000);
}
const moscowDate = getDateInTimeZone(3);
const newYorkDate = getDateInTimeZone(-5);
const tokyoDate = getDateInTimeZone(9);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question