Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.

Back

1005 - How can I calculate the correct time for an area that is different from the local time?

by - Joseph Ganci


Could anybody tell me how I can calculate the time in another timezone? Example: I'm running the CBT in Japan, and the screen shows the time in Germany. Is there a function or ucd for it?

Do you know that you're in Japan and the time will be in Germany or is this meant to work from any time zone to any time zone? I suspect the latter. If so, you can make use of the Hour, Minute, and Sec variables in Authorware to determine what the current hour, minute, and second is, then subtract or add the correct number to Hour to show on the screen. To set up the subtraction/addition amount, set up everything in accordance with GMT. So, let's say that you're in Italy. That means you're one hour ahead of GMT so that would have a value of 1. Now let's say that you're running this in Washington, DC, which would have a value of -5 GMT (not taking into account daylight savings time here). Then the difference between the two is 6 (the difference between -5 and 1). If that number is stored in a variable called difference you could set up a script like the following:

showtime := hour + difference ^ ":" ^ minute ^ ":" ^ sec

That means if the current time is 5:03:02 in Washington, the screen will show 11:03:02 in Italy. Of course, you'll want to spruce up the above list to insert the zeroes so it looks like a proper time. I have a pretty hairy script that can be placed directly on the screen that does this. I teach it in my classes. I think there's also a copy of it in my Advanced Scripting book.


There are 0 reviews
Add your review
Back