Results 1 to 3 of 3

Thread: Displaying Different Times.......

  1. #1

    Thread Starter
    Hyperactive Member sterankin's Avatar
    Join Date
    Jul 2001
    Location
    N.Ireland
    Posts
    336

    Displaying Different Times.......

    I want a simple disaply on a form that can display the times in major cities throughout the world.........

    I used this, but I noticed it wasn't working properly >

    Public Sub getTimes()

    NewYork = Time - #4:00:00 AM#
    FrankFurt = Time + #2:00:00 AM#
    Tokyo = Time + #9:00:00 AM#
    Text1.Text = Format(Time, "Long Time")


    Text2.Text = Format(NewYork, "Long Time")

    Text3.Text = Format(FrankFurt, "Long Time")

    Text4.Text = Format(Tokyo, "Long Time")
    End Sub




    i.e., where Time is just the time on my computer (GMT), so new York is 4 hrs behind, but I think I am subtracting 4 o'clock, not 4 hrs.......how can I just take away 4 hrs........? etc for the rest.

    Thanx for any help

    Steven

  2. #2
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    An example to subtract 4 hrs from current time:

    VB Code:
    1. Private Sub Command1_Click()
    2. Dim newtime As Date
    3. newtime = DateAdd("h", -4, Now)
    4. Debug.Print FormatDateTime(newtime, vbLongTime)
    5. End Sub

  3. #3
    jdn
    Guest
    You can use DateAdd function. Example:

    Dim myTime As Date
    Dim NewYorkTime As Date

    myTime = Now()
    NewYorkTime = DateAdd("h", -4, myTime)

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