0

This is simple current time zone clock so i want specific time zone like INDIA if any person open my site in US or any Out of India, that people can see INDIAN Time not US time. So Please Can any one help to add specific time zone in this code.

function date_time(id)
{
        date = new Date;
        year = date.getFullYear();
        month = date.getMonth();
        //months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December');
        d = date.getDate();
        day = date.getDay();
        days = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
        //days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
        h = date.getHours();
        if(h<10)
        {
                h = "0"+h;
        }
        m = date.getMinutes();
        if(m<10)
        {
                m = "0"+m;
        }
        s = date.getSeconds();
        if(s<10)
        {
                s = "0"+s;
        }
        result = ''+d+' '+months[month]+' '+year+' - '+days[day]+' - '+h+':'+m+':'+s;
        document.getElementById(id).innerHTML = result;
        setTimeout('date_time("'+id+'");','1000');
        return true;
}
  • A wise decision will be `showing the UTC time`. – Praveen Dec 04 '13 at 12:14
  • See the dup post for handling any time zone. But if you want, you could take advantage of the fact that India is UTC+5:30 with no DST. If all you need is India, you can start from UTC and use simple math. – Matt Johnson-Pint Dec 04 '13 at 13:55

1 Answers1

0

You may use this js timezone-js

for further reference you may refer this Question

Community
  • 1
  • 1
Yagnesh Agola
  • 4,556
  • 6
  • 37
  • 50