i am working on javascript which displays time based on location, 开发者_如何学运维that is if a user logs on from china it should display their local time or a user from india it should display their code.No matter what, i am not able to get the code.pls someone help.
You can get the users local time in JS with:
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10)
minutes = "0" + minutes
document.write("<b>" + hours + ":" + minutes + " " + "</b>")
精彩评论