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)