Analog Clock in flash with UTC +5:30... help !!!

Posted on 2007-10-01
Medium Priority
Last Modified: 2008-01-09

I created 8 different analog clocks and managed to run different timezones on them but still there is a glitch... I can add the timezones to the UTC like +4, -3 etc but dont know how to add +5:30 to it any ideas??? below is the piece of code i am using for implimenting different timezones.

clock2.onEnterFrame = function () {
clockDate = new Date();
seconds = clockDate.getUTCSeconds();
this.secondsHand._rotation = seconds * 6;
minutes = clockDate.getUTCMinutes();
this.minutesHand._rotation = minutes * 6;
hours = clockDate.getUTCHours();
hours = hours +(minutes/60);
hours = hours + 12;
this.hoursHand._rotation = (hours * 30)+(minutes/2);

Question by:Shabzt
  • 2
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 19991475
just add 5.5 into hours..

Aneesh Chopra

Author Comment

ID: 19992126
adding 5.5 works in javascript, but i have already tried adding 5.5 in actionscript it doesn't give the desired output.
LVL 34

Accepted Solution

Aneesh Chopra earned 2000 total points
ID: 19996489
Here is the fixed code:

clock2.onEnterFrame = function()
      clockDate = new Date();
      seconds = clockDate.getUTCSeconds();
      this.secondsHand._rotation = seconds*6;
      minutes = clockDate.getUTCMinutes();
      // add minutes here
      minutes += 30;
      hours = clockDate.getUTCHours();
      hours = hours+(minutes/60);
      minutes = (minutes>=60) ? minutes-60 : minutes;
      // add hours here
      hours = hours+5;
      this.minutesHand._rotation = minutes*6;
      this.hoursHand._rotation = (hours*30)+(minutes/2);

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a Synology DS212+ NAS.  These are not only great for backup and normal NAS stuff, but also for delivering media throughout your home or LAN via DLNA.  I copied my whole audio collection from iTunes over to the box, but couldn't figure out how…
Tired of waiting for your show or movie to load?  Are buffering issues a constant problem with your internet connection?  Check this article out to see if these simple adjustments are the solution for you.
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question