[英]I need to convert UTC date and time based on the local timezone using moment.js, how to convert date from UTC to timezone in html
[英]How to convert Local Date Time to UTC and UTC to specific TimeZone using javascript?
1) var sd = new Date("2018-02-20T00:00:00");
我想將此本地日期轉換為 UTC DateTime。
2)如何將“2018-02-20T08:00:00Z”這個UTC日期轉換為“印度標准時間”或任何時區標准。
var isoDate = new Date('2018-02-22').toISOString();
這可能有效:
var sd = new Date("2018-02-20T00:00:00");
var utc = new Date(sd.getUTCFullYear(), sd.getUTCMonth(), sd.getUTCDate(), sd.getUTCHours(), sd.getUTCMinutes(), sd.getUTCSeconds());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.