Results 1 to 12 of 12
  1. #1
    New Lounger
    Join Date
    Sep 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    UK time in indian system

    hi all


    is any code for show uk time in userform created on indian system.


    example: if system time show 08:30 AM at same time how to show 04:00 AM in userform


    i tried it to make running clock but failed please help
    for reference see attached file
    Attached Files Attached Files

  2. #2
    Silver Lounger
    Join Date
    Mar 2014
    Location
    Forever West
    Posts
    2,079
    Thanks
    0
    Thanked 259 Times in 248 Posts
    I opened your attachment but the Excel sheets appear to be blank

  3. #3
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,641
    Thanks
    115
    Thanked 652 Times in 594 Posts
    Try this formula to calculate UK time when India time is Known:

    Code:
    Cell C2 =TEXT((24-B2)+(A2),"H:MM")
    Where A2 is India Time and B2= 5:30 (because India is GMT +05:30). You can replace 5:30 with any time zone to find time in other places on the globe.

    HTH,
    Maud
    Last edited by Maudibe; 2016-09-08 at 06:47. Reason: Additional colon removed as picked up by Paul T

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,203
    Thanks
    49
    Thanked 989 Times in 919 Posts
    Double colon in the format?

    cheers, Paul

  5. #5
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,641
    Thanks
    115
    Thanked 652 Times in 594 Posts
    Nice pickup on the typo Paul.

  6. #6
    New Lounger
    Join Date
    Sep 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    tried but not working

  7. #7
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,203
    Thanks
    49
    Thanked 989 Times in 919 Posts
    What's not working? Sample output please.

    cheers, Paul

  8. #8
    New Lounger
    Join Date
    Sep 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i tried it to make running clock but failed please help
    for reference see attached file
    Attached Files Attached Files

  9. #9
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,641
    Thanks
    115
    Thanked 652 Times in 594 Posts
    ManissinhAS,

    The formula was a sheet formula. For VBA you will need the code:

    In a command button:
    Code:
    Private Sub CommandButton1_Click()
    TextBox2 = Format(24 - TimeValue("5:30") + TimeValue(TextBox1.Value), "HH:MM")
    End Sub
    ...where Textbox1 is the India time and Textbox2 is the calculated UK time. If this were my project, I would place the code in the TextBox1_KeyUp event routine and add validation that when a time is entered in hh:mm format, a calculated time will result in textbox2'. There would be no need for a command button to initiate the calculation

    HTH,
    Maud

    India2UK.png
    Attached Files Attached Files

  10. #10
    New Lounger
    Join Date
    Sep 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Maud

    but i want running time which show 4:30 hrs prior to system time .

    please find attachment for reference

    please help

    thanks
    Attached Files Attached Files

  11. #11
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,641
    Thanks
    115
    Thanked 652 Times in 594 Posts
    Sounds you are looking for something like this


    In the UserForm Module"
    Code:
    Private Sub UserForm_Activate()
        TextBox1 = Format(Time, "HH:MM")
        TextBox2 = Format(24 - TimeValue("4:30") + TimeValue(Time), "HH:MM")
        Application.OnTime Now + TimeValue("00:01:00"), "AdvanceTime"
    End Sub
    In a Standard Module
    Code:
    Public Sub AdvanceTime()
        With UserForm1
            .TextBox1 = Format(Time, "HH:MM")
            .TextBox2 = Format(24 - TimeValue("4:30") + TimeValue(Time), "HH:MM")
        End With
            Application.OnTime Now + TimeValue("00:00:30"), "AdvanceTime"
    End Sub
    The code assumes you have a form called UserForm1 with TextBox1 and TextBox2. When the userform is opened, it will display the system time in Textbox1 and a time 4 1/2 hours earlier in TextBox2. Both textboxes will be updated every minute. You should set the userform's modal property to false so you can work elsewhere as the clock ticks on.

    HTH,
    Maud


    India2UK_3.png
    Attached Files Attached Files
    Last edited by Maudibe; 2016-09-09 at 15:03.

  12. #12
    New Lounger
    Join Date
    Sep 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Maud

    thanks for your support
    i have made some changes in your code . and got what i want .

    see attachment'.....
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

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