Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get browser current timezone with jQuery?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 2.46k
    Comment on it

    Sometimes we need to identify the clients timezone to make some calculation on time. For example - we want to save current time based on user's timezone into database, so in this case we need to get the user's current timezone.

    To do this download the "jstz.js" and write the below code into the html file:

    <script src="/scripts/jstz.js"></script>
    <script type="text/javascript">
    
    $(function() {
        var tzObj = jstz();
        var timezoneCode = tzObj.timezone_name;
        $('#timeZone').val(timezoneCode);
    });
    </script>
    
     <input type="text" name="timeZone" id="timeZone">
    

    Hope this will help you:)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: