Timezone calculator. - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Timezone calculator. (/thread-7697.html) |
Timezone calculator. - Moneo - 07-15-2005 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. ***** Timezone calculator. - DrV - 07-15-2005 It seems there are 25 integer time zones (this confuses me...) and various other non-integer time zones: http://wwp.greenwichmeantime.com/info/timezone.htm Should only the 24/25 integer time zones be allowed, or should the nonstandard zones be taken into account also? Timezone calculator. - Moneo - 07-15-2005 Yeah, you're right. It's the old "relative to zero" problem. Quoting from your mentioned webpage: "There are 25 integer World Time Zones from -12 through 0 (GMT) to +12." So, we have to use a total of 25 timezones. And, let's not use any of the non-standard ones. ***** Timezone calculator. - rpgfan3233 - 07-15-2005 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. . . Timezone calculator. - Moneo - 07-15-2005 Quote: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. . . 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. ***** Timezone calculator. - Deleter - 07-16-2005 http://en.wikipedia.org/wiki/Time_zones lists all the time zones...some are :45 O_o Timezone calculator. - rpgfan3233 - 07-16-2005 After reading that article that Deleter provided (which was quite useful), it appears that there WERE 24 time zones, but some areas in certain time zones changed somehow. For example, UTC+14 was changed from UTC-10 by simply skipping 1994-12-31!! UTC+12 was created, changing from UTC-12, so really there are only 24 time zones: GMT-12 (UTC-12) to GMT+11 (UTC+11), despite these technicalities. For the sake of simplifying this challenge, I recommend we use just the 24. Timezone calculator. - Moneo - 07-16-2005 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? ***** Timezone calculator. - rpgfan3233 - 07-16-2005 Nice list. I agree with the terms. It makes it much easier. DST is hard to implement also because some time zones require it and some do not. Timezone calculator. - Moneo - 07-16-2005 Quote:Nice list. I agree with the terms. It makes it much easier. DST is hard to implement also because some time zones require it and some do not. Thanks, that makes two of us. ***** |