+ Reply to Thread
Results 1 to 6 of 6

timezone calculation

  1. #1
    Registered User
    Join Date
    03-12-2007
    Posts
    2

    Unhappy timezone calculation

    Hello Everybody!

    I am having a rather curious problem, and any ideas/help on this is Greatly Appreciated! I am writing a function called "DisplayTime" that calculates the time in any country, based on user input. for e.g. I want the user to be able to type in =DisplayTime("Albania") in a cell and the function will return the time in Albania. He/she can hence choose any country and have the function return the current local time in that country. For this purpose, I have a list of countries and their respective GMT offsets.

    A scaled down version of this function looks like:


    Please Login or Register  to view this content.
    When I run this code I dont get the times im looking for! In fact i get some weird dates like "12/23/1899 10:51:18 AM".

    Somebody help!

    Regards,
    J

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Use following ...
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Try with this code:

    Please Login or Register  to view this content.
    Use TimeSerial (hours, minutes, seconds)

    Regards,
    Antonio

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad it fixed your problem ...

  5. #5
    Registered User
    Join Date
    03-12-2007
    Posts
    2

    Time Zone Calculation


    Hello Carim, Antonio,

    Thank you both so much for your replies! I'm sorry I couldnt reply sooner.

    I tried out the TimeSerial Function and yes it worked!!
    However when I print it out displaying the date and time, it shows up like "30/12/1899 07:56:53" for GMT and "30/12/1899 08:56:53" for Albania time.

    My code now looks like:


    Please Login or Register  to view this content.

    I can do with just displaying the time, but displaying the date as well would be a bonus!

    Once again thank you both for your replies!

    Regards,
    J


  6. #6
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Just use
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1