|
Pages: [1] 2 3 4
|
 |
|
Author
|
Topic: Timezone calculator. (Read 14125 times)
|
Moneo
Na_th_an
    
Posts: 1971
|
My son is in Japan this week participating in a Robocup (robots that play soccer) competition. Anyway, we in the family have a tough time figuring out what date and time it is over there. This made me think of a timezone calculator.
I haven't done it yet myself, but here are the requirements: - Program written in QB or Quickbasic. - Time always expressed in military time, example 17:30. - Input timezones will be expressed as GMT +nn or GMT -nn. - Dates formatted as mm/dd/yyyy. - Input #1: the timezone, date and time that the user is in. This allows user to specify any date/time. Example: I will be in Singapore on 08/15/2005 at 10:00. What date/time will it be then in New York? - Input #2: the timezone for which a date and time will be calculated based on the input. - Perform adequate input validation. - Output: the calculated timezone, date and time, plus the most important city in that timezone. Note: You determine the most important city.
NOTE: THE ABOVE SENTENCE WAS CORRECTED TO READ: - Output: the calculated date and time for the timezone specified in Input #2, also displaying the city name for the timezone.
Considerations: - You'll need to find the 24 time zones on the Internet. Refer to them as GMT +nn or GMT -nn. Also, assign the name of the most important city to each of the 24 timezones. - Also on the Internet, you will have to find whether the most important city in each timezone is on daylight savings time or not. NOTE: THE ABOVE DAYLIGHT SAVINGS TIME REQUIREMENT HAS BEEN SUSPENDED.
Please submit a complete working program, not just a function. I'll check every entry and provide feedback. *****
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|
|
|
Moneo
Na_th_an
    
Posts: 1971
|
Hmm. . . According to this board's settings, there are 26, from GMT-12 to GMT+13!? I'm thoroughly confused now. . . I could have sworn there were only 24 because GMT-12 and GMT+12 are the same. . .
Edit: At least, I THOUGHT they were. . . Now I'm confused myself. I'm going to check into this further. In the meantime, would you guys kindly explore this issue and provide some more feedback. *****
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|
Moneo
Na_th_an
    
Posts: 1971
|
Boy, do we have a can of worms regarding timezones.
I consulted my Encyclopaedia Britannica and World Book Encyclopedia and they both define 24 standard timezones.
There are numerous exceptions, but for this challenge, we will use the 24 timezones on the following list. I have included principal country/city names.
Also for this challenge, we will ignore the issue of daylight savings or summer time. It becomes almost impossible for our program to determine if the subject timezome uses daylight savings, when it starts and ends, and whether it advances one hour or two. Therefore, we will leave this daylight time adjustment up to the user of the program.
TIMEZONES: GMT = London GMT - 1 = Reykjavik GMT - 2 = Greenland GMT - 3 = Rio de Janeiro, Brazil GMT - 4 = Santiago de Chile GMT - 5 = New York GMT - 6 = Chicago GMT - 7 = Denver GMT - 8 = Seattle GMT - 9 = Alaska GMT -10 = Honolulu GMT -11 = Midway Island GMT -12 (does not exist, see GMT +12)
continuing in a circle around the world............ GMT +12 = New Zealand GMT +11 = Solomon Islands GMT +10 = Sydney GMT + 9 = Tokyo GMT + 8 = Hong Kong, and China GMT + 7 = Bangkok GMT + 6 = Omsk, Russia GMT + 5 = Karachi GMT + 4 = Stalingrad GMT + 3 = Moscow GMT + 2 = Cairo GMT + 1 = Berlin
Comments? *****
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|
|
|
|
|
anarky
Been there, done that
    
Posts: 1226

The Blobworld Comics King
|
Boy, do we have a can of worms regarding timezones.
I consulted my Encyclopaedia Britannica and World Book Encyclopedia and they both define 24 standard timezones.
There are numerous exceptions, but for this challenge, we will use the 24 timezones on the following list. I have included principal country/city names.
Also for this challenge, we will ignore the issue of daylight savings or summer time. It becomes almost impossible for our program to determine if the subject timezome uses daylight savings, when it starts and ends, and whether it advances one hour or two. Therefore, we will leave this daylight time adjustment up to the user of the program.
TIMEZONES: GMT = London GMT - 1 = Reykjavik GMT - 2 = Greenland GMT - 3 = Rio de Janeiro, Brazil GMT - 4 = Santiago de Chile GMT - 5 = New York GMT - 6 = Chicago GMT - 7 = Denver GMT - 8 = Seattle GMT - 9 = Alaska GMT -10 = Honolulu GMT -11 = Midway Island GMT -12 (does not exist, see GMT +12)
continuing in a circle around the world............ GMT +12 = New Zealand GMT +11 = Solomon Islands GMT +10 = Sydney GMT + 9 = Tokyo GMT + 8 = Hong Kong, and China GMT + 7 = Bangkok GMT + 6 = Omsk, Russia GMT + 5 = Karachi GMT + 4 = Stalingrad GMT + 3 = Moscow GMT + 2 = Cairo GMT + 1 = Berlin
Comments? ***** It's easy to add the non-standard timezones. DST is harder, since that splits Australia up into a real mess. Darwin is GMT +9:30. So is Adelaide. Darwin and the NT do not have DST. Adelaide and SA do. Brisbane in QLD does not have DST, NSW, Vic and Tas have DST. WA does not. For ease of reading, I won't include the ACT, which is surrounded by NSW anyway. During the winter time of the year, such as now, we have: GMT +8:00 WA GMT +9:30 SA, NT GMT +10:00 QLD, NSW, ACT, VIC, TAS During summer months: GMT +8:00 WA GMT +9:30 NT GMT +10:00 QLD GMT +10:30 SA GMT +11:00 NSW, ACT, VIC TAS Then what about the middle east? Last I heard, the whole area is one time zone, instead of 5 or 6. The former USSR? 11 zones... My opinion would be the following: include the GMT +/- x:30 non standard timezones. Don't include DST. BTW, I live in SA. That makes me GMT +9:30 atm. EDIT: According to http://wwp.greenwichmeantime.com/info/timezone.htm, Kiribati islands is over a day behind New Zealand. So Thursday in NZ is still Tuesday in Kiribati Is. >anarky
|
|
|
|
|
Logged
|
Screwing with your reality since 1998.
|
|
|
|
|
Moneo
Na_th_an
    
Posts: 1971
|
Hey guys, Is anybody working on a solution for this challenge?
Heck, my family all say it's easy, that they can do it in their head. How many hours from New York (GMT-5) to Berlin (GMT+1)? That's easy: take the 5 and add the 1, so it's 6 hours away. And when you add the 6 hours to New York time and it goes passed midnight, then the Berlin date is +1 that of NY.
Yeah, yeah, yeah, but program the sucker to handle all 24x23 from/to timezone combinations!!!!!
I've got a program in the works, but I'm having trouble deciding whether to go clockwise around the world's timezomes, or counter-clockwise. The way the sample table is set up, it's going counter-clockwise. Example: from New York (GMT-5) to Tokyo (GMT-9) is 14 timezones clockwise and 10 counter-clockwise. If I go clockwise I add 14 hours to NY time, and for counter-clockwise I subtract 10 hours. Whick is easier or best? And then what if the from and to are both GMT+ or both GMT- or from a GMT+ to a GMT-, then what's the general rule?
Have any of you guys thought about these issues? *****
|
|
|
|
|
Logged
|
|
|
|
|
Pages: [1] 2 3 4
|
|
|
|
|