Results 1 to 16 of 16

Thread: How to use GetTimeZoneInformation

  1. #1

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Wink How to use GetTimeZoneInformation

    Hi all,

    I'm working on a dialog base application, dealing with the time zone details.

    In the dialog box there is a text box to enter the time offset. Then user click the display button, on the next text box display the timezone name. If the given time offset have more than one timezone name, very first timezone name should be display.

    That's my question.

    I'm going to use Windows API for this. So that I want to read the timezone list. How can I do that using API with GetTimeZoneInformation()
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    As I've mentioned to you multiple times.. there is no such thing as a "Timezone List". The timezones aren't stored on the computer anywhere (that is.. you can't use some magical API to list the timezones for you). Its just as useless as having an API that prints the numbers 0-100 for you on screen.. useless.

    GetTimeZoneInformation, gets the offset for you.. thats it. You have to pre-program the timezone names, and offsets into your program. Then, use GetTimeZoneInformation to determine what the offset is, and have the default selection correspond to that.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    Ok, I'll explain it in this way.

    Say I have a time offset, as a example +6:00, and I want to find the time zone name. That mean I have to read the list in the registry. So how can I do that.

    Here is the list I'm talking about.
    Attached Images Attached Images  
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    Where is this list in the registry?

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    This list is not in the registry, only the details of all time zones. Those are in following path.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  6. #6
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    I don't have that information in my registry..

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  7. #7

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    I've work on XP, how about you.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  8. #8
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    XP also..

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  9. #9

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    So it is there, actually not the list in my image. But all the details are provided. So, it should be there in the registry.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  10. #10
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    It isn't.. I just checked.

    It could possibly be added there by a program you have installed..

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  11. #11

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    I don't have installed any program. How did you check the registry, I mean how to login.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  12. #12
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    Start >> Run >> regedit.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  13. #13

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    Ok, using admin account as well? So it should be there.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  14. #14
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to use GetTimeZoneInformation

    Yes.. there is only an Administrator account on this PC.. theres nothing there.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  15. #15

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    Oh dear, I don't why is that. I've check it on few machines and it is there in all of them.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  16. #16

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How to use GetTimeZoneInformation

    Dose anyone know how to work with RegEnumValue() to enumerate the registry keys.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width