Tuesday 25 December 2012

Getting Timezone ID through javascript

Introduction:

It happens to me most of the time that I need to find user local timezone id in my projects. So here is the solution. Use it in your app and enjoy.


CODE:

<script language="javascript">

function GetUserTimeZoneID(){
    var timezone=String(new Date());
     return timezone.substring(timezone.lastIndexOf('(')+1).replace(')','').trim();
     }


</script>

No comments:

Post a Comment