The local time in Bangkok is
<time class="wpas-timeagent"></time>. <strong class="">The support is now closed.</strong><strong class="">The support is now open.</strong>
<br>
<br>
<div class="another-test"></div>
<div id="result"></div>
JavaScript
function calcTime(offset) {
// create Date object for current location
var d = new Date();
// convert to msec
// add local time zone offset
// get UTC time in msec
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
// create new Date object for different city
// using supplied offset
var nd = new Date(utc + (3600000 * offset));
// return time as a string
// return nd.toLocaleString();
return nd.getHours() + ':' + nd.getMinutes();
}
$('.wpas-timeagent').html(calcTime('+7'));
// Get today's date in local timezone
// var Today = new Date();
// var d = Today.getUTCDate();
// $('.another-test').html(d);
// $("#result").load("http://www.timeapi.org/+7/now?format=%20%25I:%25M:%25S%20");
var time = Date.now()
console.log(time);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.