# Digital world clock - HELP ME PLZ!

**URL:** <https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559>\
**Category:** Uncategorized\
**Created:** [September 15, 2002, 8:23pm UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559 "2002-09-15T20:23:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![steinberginc](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@steinberginc](https://forum.kirupa.com/u/steinberginc)\
**Post date:** [September 15, 2002, 8:23pm UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/1 "2002-09-15T20:23:41Z")

</div>

Hi there.

Can someone help me what i should do with this script so that i can run 2 cocks with a different time zone (Miami EST TIME & Frankfurt, EUROPE TIME).  
I can find a lot of tutorials on [Flashkit.com](http://Flashkit.com) but all those are too complex and they have an analog script included.

IF someone can help that’d be awsome.  
Dave

* * *

1st keyframe:

myDate = new Date();  
dateTextField = (mydate.gethours()+":"+myDate.getMinutes()+":"+mydate.getSeconds());  
if (myDate.getMinutes() \< 10) {  
dateTextField = (mydate.gethours()+":0"+myDate.getMinutes()+":"+mydate.getSeconds());  
}  
if (myDate.getSeconds() \< 10) {  
dateTextField = (mydate.gethours()+":"+myDate.getMinutes()+":0"+mydate.getSeconds());  
}  
if ((myDate.getMinutes() \< 10) && (myDate.getSeconds() \< 10)) {  
dateTextField = (mydate.gethours()+":0"+myDate.getMinutes()+":0"+mydate.getSeconds());  
}

* * *

2nd frame

gotoandplay(1);  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 6:51am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/2 "2002-09-16T06:51:23Z")

</div>

All you really have to do is subtract (or add) time to the first figure and set that to a new variable.

Does that make sense to you? If not… I’ll try to come up with a better explination.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 6:56am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/3 "2002-09-16T06:56:55Z")

</div>

Well, if I am not mistaken doesn’t that script take the time off of the viewers computer. This means that whoever views it will see the time in their area.

I hope I am not mistaken, otherwise I made fool of myself.

PS: Frankfurt, Germany: Where my family is originally from=) Ok, I will stop rambling on about useless knowledge.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:02am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/4 "2002-09-16T07:02:41Z")

</div>

Nope. I think you’re right Beta… The method would be to grab the GMT and add or subtract from that, based upon location.

I’ll look up what the difference is in the morning and see what I can do with that script.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:06am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/5 "2002-09-16T07:06:23Z")

</div>

I know there is a getTimezoneOffset() feature in flash, but I have never used it so I am not sure of what it does.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:07am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/6 "2002-09-16T07:07:09Z")

</div>

Hey, lost!  
Sprichst Du deutsch? my family is also from around Frankfurt, part still lives there…

And i think you’re right, as you don’t know where the user watching the 2 cLocks (i hope you didn’t leave that l out on purpose…lol) will be, if you really want to display Miami and Ffm, you’ll have to set that up based on GMT (aka UTC) time, not user clock time:  
myDate = new Date;  
trace(myDate.getTimezoneOffset()); //thanks, Mr.Moock…  
etc…it seems a bit complicated, based on the value returned above , you’ll need to add or substract to right number to get Miami or Ffm time…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:13am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/7 "2002-09-16T07:13:11Z")

</div>

Hey eyezburg,

Ich spreche sehr kleines Deutsch. I was born and raised in Philadelphia, PA, but my family originally hails from Frankfurt.

That is some useful information too. I was thinking of working on a clock that had all the timezones (got all of them from the options in this very forum) in a dropdown menu and you can select which one you want. Now that I know that UTC is the way to go for that I will experiment more with it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:24am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/8 "2002-09-16T07:24:33Z")

</div>

Hey, Ich kann auch ein bisschen Deutsch spechen, aber Ich hab’es vor zu lange nicht gesprochen, it that means anything. And can you give the link to Moock, Eyez? I find his site spectacularly impossible to navigate.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:28am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/9 "2002-09-16T07:28:30Z")

</div>

Ilyas: Its choppy, but I think you said you also speak a little german, but you haven’t been speaking it long. Am I right?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:36am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/10 "2002-09-16T07:36:45Z")

</div>

That was the idea, yeah =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:38am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/11 "2002-09-16T07:38:53Z")

</div>

Woo Hoo!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:42am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/12 "2002-09-16T07:42:36Z")

</div>

\*\*\*\* foreigners. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:45am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/13 "2002-09-16T07:45:26Z")

</div>

Haha, Ironisch ertönen Sie meine Schwestern mag:P

English: Ironically you sound like my sisters | (they say the same thing)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 11:37am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/14 "2002-09-16T11:37:39Z")

</div>

OK alle zusammen, nachdem Deutsch geklaert wurde… can someone give me a script that will get from the internet the time. I thought about that that this might be a user time clock. However those others scripts what i found on the net were quite too complicate for me since they had all thise variables for the analog time included. I will check Mooks site. Thanks for that tip but if someone ever did this please help out with a script what i can copy/past/ GG

Ciao all  
Dave

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 11:57am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/15 "2002-09-16T11:57:17Z")

</div>

myDate2 = new Date();  
dateTextField = (mydate2.gethours()+6+":"+myDate2.getMinutes()+":"+mydate2.getSeconds());  
if (myDate2.getMinutes() \< 10) {  
dateTextField = (mydate2.gethours()+6+":0"+myDate2.getMinutes()+":"+mydate2.getSeconds());  
}  
if (myDate2.getSeconds() \< 10) {  
dateTextField = (mydate2.gethours()+6+":"+myDate2.getMinutes()+":0"+mydate2.getSeconds());  
}  
if ((myDate2.getMinutes() \< 10) && (myDate.getSeconds() \< 10)) {  
dateTextField = (mydate2.gethours()+6+":0"+myDate2.getMinutes()+":0"+mydate2.getSeconds());  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 4:06pm UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/16 "2002-09-16T16:06:35Z")

</div>

The problem with that script is that it shows the right time on YOUR computer. Someone viewing it from that area will see their time +6 hours like you have in your script.

I don’t know how to create a Universal clock script, other wise I would help. If I get any free time today I will see if I can whip one up for you. The keyword there is “IF”.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 7:56pm UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/17 "2002-09-16T19:56:55Z")

</div>

LOL…  
@Dave: remember…what was it, Poland…? lol, bloody foreigners…🙂

@all of ya: not bad, quite a few words of German resisted the assault of alcohol on your braincells!  
When i said, thanks Moock, that was not the site, it was the book, no download or cut’n’paste so far…Rumours have it he’s working on an MX version …

@lost: right, dude.

@steinberginc: with a nick’ like that, you’re requiered to speak German!  
I don’t know if I’ll get the time to try’n code that, specially as I don’t need that right now and have little time enuff, ask sbeener, he’ll write that script in about 2 mins for ya, lol.

Work on what you got, and don’t use the fixed value (6) to add, instead do a check on the “myDate.getTimezoneOffset()” to return the gmt offset value, and this value needs then to be compared to the miami or ffm offset to work out the actual number to add/substract… makes sense?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2002, 8:37pm UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/18 "2002-09-16T20:37:47Z")

</div>

Ok, here is a link to my non-military clock tutorial…

[NON-MILITARY CLOCK TUTORIAL](http://www.8ballcreations.com/lostinbeta/experimental/clocktutorial.html)

Follow that link and follow the tutorial, the only difference will be replacing the code in the Layer “Actions” with this instead of what is on the tutorial…

```auto
function updateTime() {
	myTime = new Date();
	milliseconds = myTime.getUTCMilliseconds();
	seconds = myTime.getUTCSeconds().toString();
	while (seconds.length<2) {
		seconds = "0"+seconds;
	}
	minutes = myTime.getUTCMinutes().toString();
	while (minutes.length<2) {
		minutes = "0"+minutes;
	}
	hours = myTime.getUTCHours().toString();
	delete myTime;
	for (clock; (hours>=13); hours -= 12) {
	}
	for (clock; (hours == 0); hours=12) {
	}
}
stop();

```

That will return the Universal Time (I believe, I tested it out, and it works, but I don’t know what the universal time really should be)

To change the time according to time zone change this…

```auto
hours = myTime.getUTCHours().toString();

```

to this…

```auto
hours = (myTime.getUTCHours().toString())-4;//subtract or add hours

```

-4 is the code to get the time in my area, you can change that whatever you need. Of course you will have to have 3 different functions for the 3 different clocks, which is very inefficient, but it works. There is probably some way to optimize this, but I just don’t have the time to work on that.

\<B\>PS: The tutorial says written for MX, but I recently got a chance to try it in Flash 5 and it works in both, so if you use 5, don’t worry\</B\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2002, 1:33am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/19 "2002-09-17T01:33:15Z")

</div>

i came up with something that will get your computer time and then minus the difference to get gmt time…you could then add on to this the difference of time between GMT and the time where u want it to line up with…well heres the code…

```auto

_root.createTextField("clock",0,275,200,400,200);
_root.onEnterFrame=function(){
	myDate = new Date();
	hours = myDate.getHours()
	timeZone = myDate.getTimezoneOffset()/60
	gmt= (hours+timeZone);
	clock.text = gmt+" : "+myDate.getMinutes()+" : "+myDate.getSeconds();
}

```

Ok hope it helps…its a bit shorter than some… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2003, 8:07am UTC](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559/20 "2003-07-04T08:07:17Z")

</div>

zu viele deutscher hier drinn!

war nur ein witz(nicht so lustig weis ich)

\*\*\*\* i think my german is kaput

[Next page](https://forum.kirupa.com/t/digital-world-clock-help-me-plz/5559.md?page=2)
