//北京是getZoneTime(8),纽约是getZoneTime(-5),班加罗尔是getZoneTime(5.5). 偏移值是本时区相对于格林尼治所在时区的时区差值functiongetZoneTime(offset){//取本地时间varlocaltime =newDate();//取本地毫秒数varlocalmesc =localtime.getTime();//取本地时区与格林尼治所在时区的偏差毫秒数varlocalOffset =...
// add local time zone offset // get UTC time in msec utc = d.getTime() + (d.getTimezoneOffset() * 60000); // create new Date object for different city // using supplied offset nd = new Date(utc + (3600000*offset)); // return time as a string return "The local time in ...
chrome=1"><title>根据时区取得时区时间</title><metaname="Blog"content="http://www.cnblogs.com/manfredHu/"><metaname="Author"content="manfredHu"></head><body><scripttype="text/javascript">//得到标准时区的时间的函数functiongetLocalTime(i){//参数i为时区值数字,比如北京为东八...
<html><head><script language="JavaScript">// function to calculate local time// in a different city// given the city's UTC offsetfunction calcTime(city, offset) {// create Date object for current locationd = new Date();// convert to msec// add local time zone offset// get UTC time...
<script type="text/javascript"> var d = new Date() var gmtHours = d.getTimezoneOffset()/60 document.write("The local time zone is: GMT " + gmtHours) </script> 1. 2. 3. 4. 5. 6. 7. 输出: The local time zone is: GMT -8...
JavaScript getTimezoneOffset() 方法 JavaScript Date 对象 定义和用法 getTimezoneOffset() 方法可返回格林威治时间和本地时间之间的时差,以分钟为单位。说明 getTimezoneOffset() 方法返回的是本地时间与 G...
Mar 2012 05:50:34 GMT" // two hours less than my local time> Math.floor(d1.getTime(...
例如:var timezoneOffset = new Date().getTimezoneOffset(); 使用getTime()方法获取办公时间的时间戳。例如:var officeTimestamp = officeDate.getTime(); 根据时区差值调整办公时间的时间戳,使其转换为当地时间。例如:var localTimestamp = officeTimestamp - (timezoneOffset * 60 * 1000); 使用...
http://www.techrepublic.com/article/convert-the-local-time-to-another-time-zone-with-this-...
You can also get a TimeZone using getTimeZone along with a time zone ID. For instance, the time zone ID for the U.S. Pacific Time zone is "America/Los_Angeles". So, you can get a U.S. Pacific Time TimeZone object with: