View Single Post
  #3 (permalink)  
Old May 25th, 2006, 10:55 AM
crmpicco crmpicco is offline
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks DJ Kat, this is my working script:

Code:
// Last Edit: CRM_25may06
/*
jstime.js
Clock for Paris, FR and New York, US to be displayed at the foot of all pages
Genuine code by Corneliu Lucian "KOR" Rusu mailto:corneliulucian(AROND)apropo.ro
*/
var wd=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
var D=[
['EU (Paris) Time:',60,60],//city,standard time zone(minutes), DST(minutes) 
['NA (New York) Time:',-300,60] // Six Hours behind GMT
]
function calc()
{
    var spans=document.getElementById('zonediv').getElementsByTagName('span');
    for(var i=0;i<D.length;i++)
    {
        var t=new Date();
        t.setTime(t.getTime()+(t.getTimezoneOffset()*60000)+((D[i][1]+D[i][2])*60000));//the zone's time
        var Dy=t.getFullYear();
        var Dd=t.getDate()<10?'0'+t.getDate():t.getDate();
        var Dm=t.getMonth()<10?'0'+(t.getMonth()+1):t.getMonth()+1;
        var Dh=t.getHours()<10?'0'+t.getHours():t.getHours(); 
        var Di=t.getMinutes()<10?'0'+t.getMinutes():t.getMinutes();
        var Ds=t.getSeconds()<10?'0'+t.getSeconds():t.getSeconds();
        var Dz=wd[t.getDay()];
        spans[i].firstChild.data=Dh+':'+Di+':'+Ds+' - '+Dz+' '+Dd+'/'+Dm+'/'+Dy;
    }
    //setTimeout('calc()',1000);
}
onload=function()
{
    var root = document.getElementById('zonediv');
    for(var i=0;i<D.length;i++)
    {
        root.appendChild(document.createTextNode(D[i][0]+' '));
        var sp=document.createElement('span');
        sp.appendChild(document.createTextNode(' '));
        root.appendChild(sp);root.appendChild(document.createElement('br'));
    }
    calc();
}
www.crmpicco.co.uk
www.ie7.com