|
-
Jul 21st, 2001, 06:47 PM
#1
Thread Starter
Hyperactive Member
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
-
Jul 21st, 2001, 07:42 PM
#2
Registered User
An example to subtract 4 hrs from current time:
VB Code:
Private Sub Command1_Click()
Dim newtime As Date
newtime = DateAdd("h", -4, Now)
Debug.Print FormatDateTime(newtime, vbLongTime)
End Sub
-
Jul 21st, 2001, 07:43 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|