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

Posted on 2007-10-01
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
    LVL 34

    Expert Comment

    by:Aneesh Chopra
    just add 5.5 into hours..

    Aneesh Chopra

    Author Comment

    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

    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Logo design 8 43
    D3, SVG, dragging 3 65
    merging MP3 audio files 10 79
    What is the best cd/dvd burning software available? 8 20
    Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
    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…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now