var aestTime = new Date().toLocaleString("en-US", {timeZone: "Australia/Brisbane"});
aestTime = new Date(aestTime);
console.log('AEST time: '+aestTime.toLocaleString())
var asiaTime = new Date().toLocaleString("en-US", {timeZone: "Asia/Shanghai"});
asiaTime = new Date(asiaTime);
console.log('Asia time: '+asiaTime.toLocaleString())
var usaTime = new Date().toLocaleString("en-US", {timeZone: "America/New_York"});
usaTime = new Date(usaTime);
console.log('USA time: '+usaTime.toLocaleString())
This is the output from running the above code:
AEST time: 11/12/2019, 3:39:31 PM
test.html:36 Asia time: 11/12/2019, 1:39:31 PM
test.html:40 USA time: 11/12/2019, 12:39:31 AM
Without giving timezone I want the receive the same output, how do I do that?
var aestTime =
output :- 11/12/2019 3:39:31 PM
var asiaTime =
output:- 11/12/2019, 1:39:31 PM
var usaTime =
11/12/2019, 12:39:31 AM