使用时区将日期转换为UTC [英] convert Date to UTC with timezone
本文介绍了使用时区将日期转换为UTC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码是
var convertLocalTimeToUTC = function(){
var fromdate = document.getElementById( hdnfromdate) 。 value ;
};
i这里有javascript函数
fromdate是从数据库中检索的当前日期
i希望以UTC格式转换此日期。
解决方案
参考如何将JavaScript日期转换为UTC? [ ^ ]
试试使用此JavaScript将本地时间转换为另一个时区 [ ^ ]
my code is
var convertLocalTimeToUTC = function() {
var fromdate = document.getElementById("hdnfromdate").value;
};
i have javascript funtion here in
fromdate is current date which retreive from database
i want to convert this date in UTC format .
解决方案
refer How do you convert a JavaScript date to UTC?[^]
Try the example at Convert the local time to another time zone with this JavaScript[^]
这篇关于使用时区将日期转换为UTC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文