[英]How to get current time by passing timezone in javascript
is it possible to get the current time by providing timezone in javascript?是否可以通过在 javascript 中提供时区来获取当前时间? Here I have- timezone -
America/Detroit
我在这里-时区-
America/Detroit
var d = new Date();
is it possible to get current time by providing America/Detroit?是否可以通过提供美国/底特律来获得当前时间?
let date = new Date;
let strTime = date.toLocaleString("en-US", { timeZone: 'America/Detroit' });让 strTime = date.toLocaleString("en-US", { timeZone: 'America/Detroit' }); console.log(timeZone, strTime);
console.log(timeZone, strTime);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.