Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Local Time Of My Country And Local Time Visitor



Dear all,

For a client's website in Holland, I would like to display the current Dutch date and time and I want to show for instance American visitors their local time.

Could anyone help me by providing the code for the Dutch time (as I know how to display the local time of my visitors)?

Thank you very much!

Michiel Schenkius



FlashKit > Flash Help > Flash ActionScript
Posted on: 02-08-2002, 11:31 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Converting A Time To Local Time
Hi basically I have 16:30 etc sent to me for a server which is a string

I substr it so I get 16 and 30 in seperate vars

But want to convert 16:30 GMT to users local time zone.

I know I have to use UTC - but first I think I need to convert 16:30 into a millisecond format - is this the way to go?


Anyone got any suggestions

Flash Local Time
I have a keyframe with a text box (variable = time). I wish to apply some actionscript to this keyframe which will make the users local time (obtained from their PC) appear in the text box in 24hr digital format.


Thanks

Gettting Local Time
I am designing a flash navigation bar for a South African radio station, I need it to check the time and show which jock is currently onair, the problem I am having is that in order to get the South African local time i have to add +2 to getUTChour, this gives me SA local time. The problem happens at 24h00, getUTChour doesnt have 24h00 it goes straight to 0h00, but because i am adding 2 it messes up.

e.g

1hour: 23h00
1hour: 24h00
1hour: 25h00
1hour: 02h00

Is there another way to add 2 to GMT?

Display GMT And Local Time
Hi all,

I'm currently designing for a company called Dataworks Solutions and the site should be up soon and I'm quite impressed with myself really.... yay!

Anyhoo enough of that self ego boosting!

I have a movieclip that gets the local system time and all that, but I want also to have a clip that displays GMT time because thats what time the company works from, and from that have a clip that says "We are OPEN" or "We are CLOSED" depending upon GMT.

Reckon anyone can help me?

Display GMT And Local Time
Hi all,

I'm currently designing for a company called Dataworks Solutions and the site should be up soon and I'm quite impressed with myself really.... yay!

Anyhoo enough of that self ego boosting!

I have a movieclip that gets the local system time and all that, but I want also to have a clip that displays GMT time because thats what time the company works from, and from that have a clip that says "We are OPEN" or "We are CLOSED" depending upon GMT.

Reckon anyone can help me?

Day And Month Clock According To Local Time?
I follow the http://www.flashkit.com/tutorials/Ac...-521/index.php tutorial to make a date/month clock.
It's work but the date and month is not correct. How can i set the date and month according to local time.
Thanks

------------------------------------------
mydate = new Date(date.month);

_root.clock;

code = mydate.getDate()+"/"+mydate.getMonth();

Flash2004 Actionscript / Local Time
Hello,
What is the code for getting the local time only. That is to say the time in my country only (Colombia) which is -5 hrs gmt. Therefore only colombian time will show on my website no matter where in the world it is viewed.

Thanks help
magyar

Background Change With Local Time
I am trying to make a movie whose background changes with the local time but i cant figure out how to use Date.getHours() and incorporate a if/then to change the background color. some help on the if/then part would be helpful.

Local Time Settings And Day/night Display.
Hey all. I've posted here in the past, and have had great results from the information received.

I have a new venture I am tackling, which has in the SWF a scenic animation. I would like to make this scenic animation display day or night, depending on what time it is where a viewer is viewing my flash from.

for example:
if i (PST) am viewing the animation, it will show the sun and daylight (because it is 6pm here right now) and if I watch it tonight (say 11pm) the animation would have the moon and be dark for night time.

I want this to pull the time from the local time however. Meaning, simultaneously, if while 4pm here, for someone in new york (EST) it is night time and they should see the moon scene and be dark on the animation.

is this possible? am i even making sense? is it possible to dynamically pull the local time dependant on user's location and then; show different day/night displays?

Does UMT Really Work? How To Get Time Not Depend On Local Machine?
I've found the only advantage of using UMT: It adjusts timezone gaps to the date object. Is it possible to get real 'universal' time by action script? For example to synchronize the time of showing message for all visitors of a site.

Help Me Make Flash Clock ( Not Local Pc Time)
i seen many tutorials on how to make flash clocks. is there any tutorials to make a flash clock for a certain time zone.
i wish to make a clock for GMT-5:00
id put it on the webpage so my clan has 1 same time . instead of the clock showing everybodys local pc clocks.
any 1 know ?
ty for your time

Display Time Of My Server And Not Local Machine
Dear AS Scripters,
Let me start digging:

I'm able to display time of my local machine. But this is not what I want to achieve. I wanna display time of my server.

How would I do this? Should I use the property getTimezoneOffset?

An example would serve better. Thanks in advance for the help.

Regards,
Sudatsun

Flash 2004 Actionscript - Showing Local Time Only
Hello,
What is the code for getting the local time only. That is to say the time in my country only (Colombia) which is -5 hrs gmt. Therefore only colombian time will show on my website no matter where in the world it is viewed.

Thanks help
magyar

Getting Hours From Your Local Machine And Going To Parts Of Site Based On Time
newDate = new Date();
myHour = newDate.getHours();
// If the hours number is less than 6 (am) and greater than 18 (6 PM) the mc goes to NightTime
if (((myHour)<6and(myHour)>18)) {
tellTarget ("_root.MainBG") {
gotoAndPlay("NightTime");
}
} else {
play();
}

this is the code I have in my mc. When the Time is before 6AM and after 6PM the mc is supposed to go to the frame labeled "NightTime" all the labeling is correct so it must be an error in the actionscript. I'm not an expert so can anyone help out?

Display Date And Time Of Certain Country
i need to display time of say hongkong only ... and what i am using right now shows time from the pc you are @. i am really a beginer in actionscript so it would be great if someone could help me out and tell me wat changes should i make in the actionscript. thank you


Code:
function howlong(arg) {
if (length(arg)==1) {
arg = "0" + arg;
return arg;
}
else {
arg = arg;
return arg;
}
}
myDate = new Date();

hr = howlong(String(myDate.getHours()));
mnt = howlong(String(myDate.getMinutes()));

daytext = myDate.getDay();
dd = myDate.getDate();
mm = myDate.getMonth();
yyyy = myDate.getFullYear();

switch (daytext) {
case 0: daytext = "Sunday";
break;
case 1: daytext = "Monday";
break;
case 2: daytext = "Tuesday";
break;
case 3: daytext = "Wednesday";
break;
case 4: daytext = "Thursday";
break
case 5: daytext = "Friday";
break;
case 6: daytext = "Saturday";
break
}

switch (mm) {
case 0: mm = "January";
break;
case 1: mm = "February";
break;
case 2: mm = "March";
break;
case 3: mm = "April";
break;
case 4: mm = "May";
break
case 5: mm = "June";
break;
case 6: mm = "July";
break
case 7: mm = "August";
break
case 8: mm = "September";
break
case 9: mm = "October";
break
case 10: mm = "November";
break
case 11: mm = "December";
break
}


textdate = (hr + ":" + mnt + " - " + daytext + "," + dd + " " + mm + " " + yyyy)

Display Date And Time In A Certain Country
Hi guys!

By default, when you visit a website that is made entirely in Flash and there is a Tme and Date movie clip feature... you know... it gets the current time and date of your computer so you're actually seeing your own time, right?

What I've always wanted to do is when you visit a website that is made entirely in Falsh, and you have a Time and Date movie clip that tells the creators current time and the current date instead of just getting the values of your computer time and displaying your own. I'm in the Philippines so I want the visitors of my site to view what time and date is it in the Philippines.

Can it be done?

Display Date And Time In A Certain Country
Hi guys!

By default, when you visit a website that is made entirely in Flash and there is a Tme and Date movie clip feature... you know... it gets the current time and date of your computer so you're actually seeing your own time, right?

What I've always wanted to do is when you visit a website that is made entirely in Falsh, and you have a Time and Date movie clip that tells the creators current time and the current date instead of just getting the values of your computer time and displaying your own. I'm in the Philippines so I want the visitors of my site to view what time and date is it in the Philippines.

Can it be done?

Local Runtime Sharing? Local External AttachMovie?
I've been trying and searching through the forums but I think I am searching for the wrong keywords.

Is there ANY way of setting it up so that I can use attachMovie/removeMovieClip on external swf's? I've found these runtime sharing options but I am unable to make much sense of them. What I am creating is something that would always be run locally on a machine and not up on the web.

I want to use this one main 'engine' type of file that loads heaps of different movies into it. All of them swf's. Of course I realise that I could do things the loadMovie way, but it seems in this case like an option not really suitable for what I want to do.

Thanks for any tips

Launching A Local Html File From Local Swf ( Flash 8.)
Hello everyone i am having a problem launching a local html file from my swf. i have a button called print that when clicked it is supposed to open the local html file and print out the content. this is the code i used on the button

on (release){
getURL("folder/folder/file.htm","_self");
}

i also tried scripting it on the time line when that didn't work.

any ideas?
Thanks,
kool

User Defines Local Image And Add It To A Local Swf(CD) ?
I have to run flash (swf) locally, which in my case means a CD.

What I want to do is allow the user to have a browse (local) function and pick an image from his hard disk and use that image to see a flash movie (swf) with his/her selected image in it!

Then after the user watched the movie with his/her photo on it, the user should be able to send this movie in a site(upload it). then naturally the user should be able to see it online at that site as well!

So my questions are how to have a browse function that puts the selected image somewhere I would like it to and then use this image in a flash movie (that will be a game with the photo on it).

And I guess then to send it online I do not really have to publish a new swf with the image in it, I can send seperately the swf (game) and the image file to the server through php? Did i get that right?

So far I know flash 8 has a new class for browsing, but how do I take a file selected from a user locally and use it in the movie again locally? load variable can do that but I should know the name of the file selected and also be possible to even select a local file??

Basically it is for educational movie. It will run from a CD. there will be many interactive exercices. At the end of the section there will be one game that in order to make it more personal I want to allow the users to add their photo at the game. So far everything should take place locally. Then if the user desires should be able to send in a specific site the movie he/she just watched(which means with their photo in it).

ANy ideas how I do that.

Even general ideas will help!

Thank you

Problem With Local File And Local Link
Hi to everybody,

I have installed a new version of flash player (9,0,28,0) and when I open a local file like:
c: estindex.html

When I click into some link that point to some local file like as:
c: est est.htm

I don't obtain nothing the page still remain index.html.

If i put the test directory into some server everithing working fine.
I have tried to change some machine and i have tried some old flash file but still the same!

How can solve it without upload all file everytime into some web server and without install some local web server?

Thanks in advance to everybody for any tips and sorry for my bad english!

John

How Can I Get A Local Path Of The Local Disk With Swf
Since FileReference.download() doesn't download multiple files, I want to download files with php ftp_get by FTP.
I need to pass the local path of the local disk where I can download the files from a remote serveur. How can I get a prompt to have a user choose a folder on his computor (local disk), if any way possible?

Local To 'other' Local Coordinates
Hi, I have a clip with twenty points in it.

I am trying to do a point hit test with these and a shape a few clips down - but nowhere near the _root.

I have used local to global before but would really like to just see what the coordinates would be on the other clip.

?? Cheers, M@)

Local Exe Can't Load Local Swf's Into It?
Hi!

I have created a presentation with Flash that has an exe file which loads swf files to it with loadMovie command.

Some of our clients have had problems with this. They can execute the exe file fine, but it doesn't load any of the swf's or other external files into it. All the files are local on users computer on the same folder.

At some computers this works fine, so it seems like it is some sort of security thing that an exe file cannot load anything external to it. Has anyone had similar problems?

-sumo-

Record The Date & Time Each Time The Flash File Is Played
Hello,

Do you know an action script which will be inserted into each flash
file that is played on a stand alone display monitor.
The display monitor plays several separate flash files using load an un load movie. The script should do
the following:
1. Record the date & time each time the flash file is played
2. Record the file name that played
3. Append this information to a text/log file
This application would be used in-house and is not for the web. I did check out this tatorial useing XML but I counldn't get it to work.


Saving XML to a file when used locally


Saving xml to a file when used locally can be done in two ways, the first is this:
Cookie.setCookie(xmlobj)
and the second way is this:

yourxmlobj.toString() FSCommand("save","filename.xml")

Can you Please give me some kind of direction
Thanks!

Time Elapse - Making Something Happen After Specific Time Has Elapsed
Hi people,

I wondering if there is any code i can use to make flash continue playing a movie clip to the next frame after a certain amount of time has elapsed.

Thanks!

Lara.

Submit Button Doesn't Work First Time, Does Second Time (using Variables And Php)
I've got a button with the following actions:

code: on (press, keyPress "<Enter>") {
if (!enterEmail.length || enterEmail.indexOf("@") == -1 || enterEmail.indexOf(".") == -1) {
EmailStatus = "Please enter an E-mail address";
} else if (!FirstName.length) {
EmailStatus = "Please enter your first name.";
} else if (!LastName.length) {
EmailStatus = "Please enter your last name.";
} else if (!enterCity.length) {
EmailStatus = "Please enter the city/province/country in which you live.";
} else if (wanna = 1) {
loadVariablesNum("emailtest.php", 0, "POST");
EmailStatus = "sending form ... please wait";
output = "I would like to be a part of World of Trout's mailing list!";
loading = "YES";
nextFrame();
}
}


Which connects to this php script.


PHP Code:




<?php
$msg = "";

$user      = "myusername";
$password  = "";
$db        = "test";

$link = mysql_connect("localhost", $user, $password);
    if (!$link) die ("cant connect to mysql");

mysql_select_db($db, $link) or die ("cannot connect");

$query = "SELECT email FROM tablename WHERE email='$enterEmail'";
$result = mysql_query($query) or die (mysql_error());
if(mysql_num_rows($result)){
echo "&EmailStatus=A person with this email address has already entered.";
}
else {
$name=$FirstName." ".$LastName."";
$city=$enterCity."";
$email=$enterEmail."";
$subscribe=$wanna."";

print "&name=".$name;
print "&city=".$city;
print "&email=".$email;
print "&subscribe=".$subscribe;

print "&loading=NO";
}
?>







Here is my problem: if you hit the above mention button once, it spits out the EmailStatus message, but appears to do nothing else. No loading=Yes, no nextframe(). Tthe script is supposed to spit back the loading=NO message, which will take my movie to the appropriate frame, which it does not.

However, if you hit the button a second time, it functions normally, and does everything it is supposed to including recieving the loading=NO message, which moves my movie to the appropriate frame.

To make it simple: I hit the submit info button once, it doesn't function properly, if I hit it again, it works properly.

Is my scripting wrong, my php wrong, or is my server doing something weird?

Hopefully this all makes sense...

Random Movies Each Time The Browser's Refreshed (this Time With .fla)
Hello, all...

I found a tutorial on this subject earlier on, but the e-mail address of the person who wrote it is invalid. I've got flash files attached.

All I'm trying to do is create a movie for my web site's front page which will load and play a different movie each time the browser is refreshed. Right now all I see is all the movies loading at the same time.

Flash files attached...any ideas on how to adjust the actionscript to let only one movie play each time the page is refreshed?

Thanks in advance. Here's the main.fla...

Movie Clip Differs From Time To Time By One Pixel
I am duplicating a movie clip and sometimes it has a 1 pixel line underneeth it.
Can someone tell me why this happens/how to prevent it from happening?

Attached you see a magnified screenie of the thing.

Differnt Points In The Same Time Line Running At Same Time
Hi guys,

I have a wierd one here and I'm really hoping someone can help because I am totally stuck. Pls bear with me as this is quite difficult to explain

This is the background.
My app is a quiz game, it pulls questions from an ASP page, once the questions are pulled the quiz begins.
The main movie lasts 30 seconds and all the main movie does is pull the questions, then display the number of seconds left in the game as its timeline moves along.

The questions and answers are all handled by a submovie.
The submovie will display a question, the user has 10 seconds to answer. The answer is processed on an answer Frame, which is 10 seconds into the question timeline. After 10 seconds if the user hasn't answered then the answer Frame will display anyway and mark the answer as wrong. If the user selects an answer then the timeline will jump to the answer Frame, and skip the remaining number of seconds left. The answer frame is the last frame in the sub movie, after this frame the sub movie repeats and asks the next question.

My problem is that, say for instance, the user selects an answer in the submovie after 5 seconds then the submovie jumps to the answer frame, the answer is processed and that works fine and the next question is loaded. HOWEVER after a further 5 seconds (when the question would have naturally come to the answer frame on the timeline) the same answer is re-processed. I have lots of trac() commands s in my script which suggest that this is whats happening, but I have no idea why, or how to stop it.

In summary it seems to me that differnet points in the same time line are running at the same time. Is this possible?

Any help is much appreciated :-)

Setting A Modify Time Stamp // Update Time.
dear gang

as most of you know theres a little way to set a current date, in a rich text file. and get that info in the text file into flash.
or even just type in the latest modified date into the textfield


but i was thinking maybe there is another way, strictly in flash. with code.

now i was wondering if there was a way to set the last modification date directly in flash with the getDate instructions.

i want to use this to display the latest update time.

i know there are numerous way to accomplish this with text files / php.
but i'd like to know if theres a way in flash

Flv Player. Show Duration Time And Time Played
Hi guys,
i am tinkering about with the flv player player.
I am trying to get the time(length) and time played to display.
From what i see the metadata.duration only displays in seconds.
Does anyone know the code to turn this into a properly displaying formatted time for the flv?
Thanks
Paul

Clock Showing Server Time And Different Time Zones.
Hey all,
I have a clock that shows time according to local pc time but i want it to show according to the server. I have referred to all the Forum threads for the same but couldn't get it done. Is there any server side script to be written..if yes i can't cause i don't know any sever side scripts.I M a Designer and not a Programmer yet i can do action scripting a bit...if anyone can help please thanks in advance
whenever i change the time on my pc the time displayed gets changed.

Here's the code:
MyDate = new Date();
hours = MyDate.getHours();
minutes = MyDate.getMinutes();
seconds = MyDate.getSeconds();
hourAdjust = 0;
hours = hours+hourAdjust;
if (hours>24) {
hours = 0+(hours-24);
} else if (hours<0) {
hours = 24+hours;
}
tellTarget ("hours") {
_rotation = ((../:hours*30)+(../:minutes*.5));
}
tellTarget ("minutes") {
_rotation = ((../:minutes*6)+(../:seconds*.1));
}

tellTarget ("seconds") {
_rotation = (../:seconds*6);
}

gotoAndPlay(1);


Also can we pass an external value for .getHours(); syntax from an html?

Please help it urgent..

Flv Player. Show Duration Time And Time Played
Hi guys,
i am tinkering about with the flv player player.

I am trying to get the time(length) and time played to display.
From what i see the metadata.duration only displays in seconds.
Does anyone know the code to turn this into a properly displaying formatted time for the flv?

Thanks
Paul

Taking Time From The Time Of The Updated File
Is it possible to read the time of the updated data file and put it dynamically into flash?

Server Time Insted Of Client Time
hello flashers.

help needed.

working on a project where on the top left corner of the screen i display
the current date and a clock.
they are the user machine's date and time.

i want to display the server time rather then the user's machine time.

how can i acomplish this task?

thanks
piny.

HELP Site Plays Great 1st Time, Not 2nd Time
hi there,

I've got my site up and it plays great - the first time. The problem is, when you've visited the site once (and it's saved within your computers cookies) it will play slow when you return to it.

Can somebody please check it out and give me some ideas on how to keep this from happening?

Thanks very much!

artane

please click

Drawing Real-time During Play Time
It's kind of hard to explain, but what I want to happen is make the movie look like I'm drawing the shapes and lines during playtime. So say if I've got a character, I want it to look like he's being drawn line by line like an old Looney Tunes cartoon or such.

Any help is much appreciated!

How Can I Show The Current Time In A Particular Time Zone?
getHours gets time from the users machine, so this can vary. anyway to post the current time in a specific time zone..?

thanks.

Server Time As Opposed To System Time
hello, i'm currently working on a count down timer to the end of semsester for a website i am making for school. My problem is that the way i have my movie scripted at the moment it retrieves the time from the users computer. is there any way to have it retrieve the accurate time from somewhere else other than the users computer, so that it doesn't matter what time the user has their computer to, it will still be accurate?

Changing Military Time To Regular Time..
Here is the code I saw in the Tutorials section.. it works great.. but I don't want Military time.. I want regular hour and minutes.

here is the code.


Code:
function howlong(arg) {
if (length(arg) == 1) {
arg = "0"+arg;
return arg;
} else {
arg = arg;
return arg;
}
}
myDate = new Date();
hr = howlong(String(myDate.getHours()));
mnt = howlong(String(myDate.getMinutes()));
daytext = myDate.getDay();
dd = myDate.getDate();
mm = myDate.getMonth();
yyyy = myDate.getFullYear();
switch (daytext) {
case 0 :
daytext = "Sunday";
break;
case 1 :
daytext = "Monday";
break;
case 2 :
daytext = "Tuesday";
break;
case 3 :
daytext = "Wednesday";
break;
case 4 :
daytext = "Thursday";
break;
case 5 :
daytext = "Friday";
break;
case 6 :
daytext = "Saturday";
break;
}
switch (mm) {
case 0 :
mm = "January";
break;
case 1 :
mm = "February";
break;
case 2 :
mm = "March";
break;
case 3 :
mm = "April";
break;
case 4 :
mm = "May";
break;
case 5 :
mm = "June";
break;
case 6 :
mm = "July";
break;
case 7 :
mm = "August";
break;
case 8 :
mm = "September";
break;
case 9 :
mm = "October";
break;
case 10 :
mm = "November";
break;
case 11 :
mm = "December";
break;
}
textdate = (hr+":"+mnt+" - "+daytext+","+dd+" "+mm+" "+yyyy);

Convert Military Time To Standard Time
I need to convert a time that is being pulled in through an xml feed and it comes in military format (ie 1930) to a standard time display which in this case would be 7:30 pm. I did a quick search but didn't find anything on doing that so hopefully someone can help with that.

Countdown Time + Internet Time Server
Hi everyone. Im a noobie and trying to learn Flash and Actionscript.
I started with making some preloaders and advanced preloaders, now I want to learn to make a countdown to a specific date.
I have searched a lot after tutorials after a countdown but found some bugs.
I saw a countdown that was delay with 5 seconds. I mean, when I saw the time of my clock on the computer and the countdown on the site, it was delayed. I searched here and found this from a guy. I just copy his text and hope someone can tell me how to make it, or where to find the tutorial for AS3. (flash cs4) and that guy didnt get any help by the way...

Thanks a lot.


"I want to create a countdown timer which displays the same time for everybody in spite of their different time zones. I'd like to know how to get time and date from an Internet time server (such as time.windows.com, time.nist.gov, which is free to access) or, if not possible, how to get the time zone from the PC the SWF is running in."

HELP Site Plays Great The First Time, Not The Second Time
hi there,

I've got my site up and it plays great - the first time. The problem is, when you've visited the site once (and it's saved within your computers cookies) it will play slow when you return to it.

Can somebody please check it out and give me some ideas on how to keep this from happening?

Thanks very much!

artane

please click

Displaying The Complete Time And The Time Passed On A Flv
hello all,

i'm trying to get the lenght of a stream(flv) and display it. get the amount of time that has played on the stream and display that, it will look like this in the end :

01:32/09:45

has any one done this and what would be the best way to go about it? i already have a .asc file that grabs the stream.length and brings it back into flash in secs, but that's as far as i've gotton, and i want to go about this the right way. am i going to create a getTimer() object or is there a clientside script that will accurately display the stream.

thanks,

also, how would i go about trimming the extra characters off of the seconds?

Load Multiple Movies Time To Time...
Dear webmates :


I have created a flash which loads other flashes inside it, but I just can achieve to load one of them using the :

LoadMovie ("external_flash001.swf","loader");

But then I also that, after 10 seconds, this flash load a new "external_flash002.swf" , then after other 10 seconds another "external_flash003.swf"... and so on .. until the external_flash005.swf, and then restart again with "external_flash001.swf)...

Please I need urgent help on this issue... thanks in advance !

How To Calculate Time For Diffrent Time Zones
I have a simple clock that shows the current time using the get.Time command. My problem is this. I'm in the central time zone. So to calculate Pacific time I subtract 2 hours from hours like so
"hours = mydate.getHours() - 2 ;" So if it is 2pm it should be 12pm in the pacific. Doing my method will show that it is 12am when it is not. How can I fix this? Thanks in advance. Below is my code. I'm hoping that with a fix I can do the same for other time zones.







Attach Code

mydate = new Date();
seconds = mydate.getSeconds();
minutes = mydate.getMinutes();
hours = mydate.getHours()-2;
day = mydate.getDay();
date = mydate.getDate();
month = mydate.getMonth();
year = mydate.getFullYear();
if (hours>12) {
hours = hours-12;
ampm = "PM";
} else {
ampm = "AM";
}
if (hours == 0) {
hours = 12;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (seconds<10) {
seconds = "0"+seconds;
}
if (day==0){
day = "Sunday"
} else if (day==1){
day = "Monday"
} else if (day==2){
day = "Tuesday"
} else if (day==3){
day = "Wednesday"
} else if (day==4){
day = "Thursday"
} else if (day==5){
day = "Friday"
} else if (day==6){
day = "Saturday"
}
if (month==0){
month = "January"
} else if (month==1){
month = "February"
} else if (month==2){
month = "March"
} else if (month==3){
month = "April"
} else if (month==4){
month = "May"
} else if (month==5){
month = "June"
} else if (month==6){
month = "July"
} else if (month==7){
month = "August"
} else if (month==8){
month = "September"
} else if (month==9){
month = "October"
} else if (month==10){
month = "November"
} else if (month==11){
month = "December"
}
time = ((hours) + ":" + (minutes) + ":" + (seconds) + " " + (ampm));
datefinal = ((day) + " " + (date) + " " + (month) + " " + (year));

How To Calculate Time For Diffrent Time Zones
I have a simple clock that shows the current time using the get.Time command. My problem is this. I'm in the central time zone. So to calculate Pacific time I subtract 2 hours from hours like so
"hours = mydate.getHours() - 2 ;" So if it is 2pm it should be 12pm in the pacific. Doing my method will show that it is 12am when it is not. How can I fix this? Thanks in advance. Below is my code. I'm hoping that with a fix I can do the same for other time zones.







Attach Code

mydate = new Date();
seconds = mydate.getSeconds();
minutes = mydate.getMinutes();
hours = mydate.getHours()-2;
day = mydate.getDay();
date = mydate.getDate();
month = mydate.getMonth();
year = mydate.getFullYear();
if (hours>12) {
hours = hours-12;
ampm = "PM";
} else {
ampm = "AM";
}
if (hours == 0) {
hours = 12;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (seconds<10) {
seconds = "0"+seconds;
}
if (day==0){
day = "Sunday"
} else if (day==1){
day = "Monday"
} else if (day==2){
day = "Tuesday"
} else if (day==3){
day = "Wednesday"
} else if (day==4){
day = "Thursday"
} else if (day==5){
day = "Friday"
} else if (day==6){
day = "Saturday"
}
if (month==0){
month = "January"
} else if (month==1){
month = "February"
} else if (month==2){
month = "March"
} else if (month==3){
month = "April"
} else if (month==4){
month = "May"
} else if (month==5){
month = "June"
} else if (month==6){
month = "July"
} else if (month==7){
month = "August"
} else if (month==8){
month = "September"
} else if (month==9){
month = "October"
} else if (month==10){
month = "November"
} else if (month==11){
month = "December"
}
time = ((hours) + ":" + (minutes) + ":" + (seconds) + " " + (ampm));
datefinal = ((day) + " " + (date) + " " + (month) + " " + (year));

Copyright © 2005-08 www.BigResource.com, All rights reserved