title: How does one make a current time clock using raphael js
body: <p>I have a code for a clock using raphael library. The problem I am encountering is that I cannot get it to display the current time. I have the hands moving appropriately but it will not display "current time". I am sure there are errors in this code. However I have found the code and I am using it as a basis for my clock. I started learning this last week so I am unsure how to actually do this and what the code should say.</p>
  
  <p>Hence, how should I change this code to:</p>
  
  <p>make the clock display current time on computer. I thought that the get time function and get seconds ect should do this automatically?</p>
  
  <p>Code is as follow</p>
  
  <p>The code is as follows.</p>
  
  <pre><code>window.onload = function(){
  
  var canvas = Raphael("pane",0,0,500,500);
  
  canvas.circle(200,150,100).attr("stroke-width",2);
  canvas.circle(200,150,3).attr("fill","#000");
  
  var angleplus = 360,rad = Math.PI / 180,
  cx = 200,cy =150 ,r = 90,
  startangle = -90,angle=30,x,y, endangle;
  
   for(i=1;i&lt;13;i++)
   {
  
       endangle = startangle + angle ;
  
       x = cx + r  * Math.cos(endangle * rad);
       y = cy + r * Math.sin(endangle * rad);
  
       canvas.text(x,y,i+"");
  
        startangle = endangle;
   }
  
  var hand = canvas.path("M200 70L200 150").attr("stroke-width",1);
  var minute_hand = canvas.path("M200 100L200 150").attr("stroke-width",2);
  var hour_hand = canvas.path("M200 110L200 150").attr("stroke-width",3);
  
  var time = new Date();
  
  angle = time.getSeconds() * 6;
  
  minute_hand.rotate(6 * time.getMinutes(),200,150);
  
  var hr = time.getHours();
  if(hr&gt;12)
  hr = hr -11;
  
  hour_hand.rotate(30 * hr,200,150);
  
  var minute_angle= 6 + time.getMinutes()*6,hour_angle=0.5+   
        time.getMinutes()*30;
  setInterval(function(){
                   angle = angle + 6;
                   if(angle&gt;=360)
                   {
                       angle=0;
  
                  minute_hand.rotate(minute_angle,200,150);
                   minute_angle = minute_angle + 6;
  
                    hour_hand.rotate(hour_angle,200,150);
                        hour_angle = hour_angle + 0.5;
                   }
                    if(minute_angle&gt;=360)
                    {
                        minute_angle=0;
  
                    }
  
                   hand.rotate(6,200,150);
  
                   },1000); 
  </code></pre>