artwl artwl - 25 days ago 8
Javascript Question

How to get clients Time zone in JavaScript?

who can write a function to get clients Time zone,return value like:

EDT
EST
IST
and so on

Answer Source

toTimeString() method give time with the timezone name try out below...

var d=new Date();
var n=d.toTimeString();     

ouput

03:41:07 GMT+0800 (PHT) or 09:43:01 EDT 

Demo

or

Check : Automatic Timezone Detection Using JavaScript

download jstz.min.js and add a function to your html page

    <script language="javascript">
        function getTimezoneName() {
            timezone = jstz.determine_timezone()
            return timezone.name();
        }
    </script>