Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Displaying time for different time zones

Displaying time for different time zones

Scheduled Pinned Locked Moved C / C++ / MFC
mcphelptutoriallearning
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dennisV
    wrote on last edited by
    #1

    Hello all, Could someone please direct me to where I can get information (or better yet, sample code) on how to apply different time zones to system time (without changing the actual system time, of course). :confused: I've looked at MSDN, but found nothing useful. I also didn't find any way to obtain the list of time zones along with countries/cities that Windows itself uses for regional settings. Any help greatly appreciated, Thank you in advance, MCP, MCSD

    D 1 Reply Last reply
    0
    • D dennisV

      Hello all, Could someone please direct me to where I can get information (or better yet, sample code) on how to apply different time zones to system time (without changing the actual system time, of course). :confused: I've looked at MSDN, but found nothing useful. I also didn't find any way to obtain the list of time zones along with countries/cities that Windows itself uses for regional settings. Any help greatly appreciated, Thank you in advance, MCP, MCSD

      D Offline
      D Offline
      David Chamberlain
      wrote on last edited by
      #2

      I had to do something similar at one time with software on an aircraft that could traverse multiple time zones, although limited to those in the US. Since the computer itself had only one time zone within which it lived, we always knew the time within its own zone. This can be found with a CTime object and the member function GetCurrentTime(). This CTime object can be formatted with the member function Format(), and the time zone can be parsed out, if needed. Based on that known time zone, I made a drop-down list of US time zones by name that converted into hour offsets from the computer's zone. If they wanted local time to be referenced in Eastern Time, which they selected from the drop-down list, then this converted to adding 2 hours to the computer time before displaying. It was fairly cheap and easy, but it did the job. Good luck, Dave "You can say that again." -- Dept. of Redundancy Dept.

      D 1 Reply Last reply
      0
      • D David Chamberlain

        I had to do something similar at one time with software on an aircraft that could traverse multiple time zones, although limited to those in the US. Since the computer itself had only one time zone within which it lived, we always knew the time within its own zone. This can be found with a CTime object and the member function GetCurrentTime(). This CTime object can be formatted with the member function Format(), and the time zone can be parsed out, if needed. Based on that known time zone, I made a drop-down list of US time zones by name that converted into hour offsets from the computer's zone. If they wanted local time to be referenced in Eastern Time, which they selected from the drop-down list, then this converted to adding 2 hours to the computer time before displaying. It was fairly cheap and easy, but it did the job. Good luck, Dave "You can say that again." -- Dept. of Redundancy Dept.

        D Offline
        D Offline
        dennisV
        wrote on last edited by
        #3

        Yes, I understand that approach, but what I need is to go International :omg: That's the problem - if I choose to implement it this way, then where can I get a list of all major countries/cities with their times zones? Or is there another approach? Anyway, thank you for replying, MCP, MCSD

        D 1 Reply Last reply
        0
        • D dennisV

          Yes, I understand that approach, but what I need is to go International :omg: That's the problem - if I choose to implement it this way, then where can I get a list of all major countries/cities with their times zones? Or is there another approach? Anyway, thank you for replying, MCP, MCSD

          D Offline
          D Offline
          David Chamberlain
          wrote on last edited by
          #4

          Sorry, without knowing any details, I couldn't give you EXACTLY what you wanted. Is there any way you could let the users select an offset from GMT, rather than by selecting a city? If so, then you know your difference from GMT and could add their difference and come up with local time for them (?). If not, I guess it would be nice to have a scrolling world map that they could select their area, similar to setting the clocks on the PC. I'm surprised there isn't one of those available as an ActiveX control. Dave "You can say that again." -- Dept. of Redundancy Dept.

          D 1 Reply Last reply
          0
          • D David Chamberlain

            Sorry, without knowing any details, I couldn't give you EXACTLY what you wanted. Is there any way you could let the users select an offset from GMT, rather than by selecting a city? If so, then you know your difference from GMT and could add their difference and come up with local time for them (?). If not, I guess it would be nice to have a scrolling world map that they could select their area, similar to setting the clocks on the PC. I'm surprised there isn't one of those available as an ActiveX control. Dave "You can say that again." -- Dept. of Redundancy Dept.

            D Offline
            D Offline
            dennisV
            wrote on last edited by
            #5

            David Chamberlain wrote: Is there any way you could let the users select an offset from GMT, rather than by selecting a city? :rolleyes: That would be too easy... Unfortunately, for most of my users, this will be too hard of a task - it's not a major part of my program, just a small nice addition I want to bring in. Besides, most people won't really know what time zone they're in, and even if they do know about their own time zone, they probably won't know about another zone of the world (for example to watch time in New York, Sydney and Kuwait). David Chamberlain wrote: scrolling world map that they could select their area I've searched around, but didn't find such a control... That would be really nice though. Thank you for replying, MCP, MCSD

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups