i came across this code which shows the current time of 开发者_如何学Cthe user based on his timezone. Based on this can we tell if he is on IST or EST.plz help
<script type="text/javascript">
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10)
minutes = "0" + minutes
document.write("<b>" + hours + ":" + minutes + " " + "</b>")
</script>
i wanted to display the time along with timezone.for example 17:35 IST
var now = new Date();
localtime = now.toTimeString();
which will return something like "12:21:44 GMT-0400 (EDT)"
You cannot tell what timezone he is in - just what time they are in based on GMT - use this useful function to get your info though -> http://www.pageloom.com/automatic-timezone-detection-with-javascript
精彩评论