Computing.Net > Forums > Programming > VB6 add/subtract current time

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB6 add/subtract current time

Reply to Message Icon

Original Message
Name: rm -rf
Date: October 7, 2003 at 10:26:36 Pacific
Subject: VB6 add/subtract current time
OS: win 98se
CPU/Ram: PIII @ 500 192M
Comment:

ok i've been trying to teach myself programming for a little while and decided that i'd create a little app so when i'm chatting with somebody in another timezone it would take my current time and add/subtract the difference in hours.... so in one box i want it to display my current time and a box under it will display their time and eventually another box to put the time difference... so far i have this.....

Private Sub Timer1_Timer()
focusedTime = " " & Format(Date, "hh:mm:ss")
thetime = Time
Text1.Text = thetime

End Sub

and i'm wondering how i'd add/subtract thetime to get there time in text2...
i know theres smart people here so i'm sure one of you knows what you're doing cuz i sure don't

thx in advance


Report Offensive Message For Removal


Response Number 1
Name: rm -rf
Date: October 7, 2003 at 20:23:09 Pacific
Reply: (edit)

another idea i have to do this but i'm not sure how to do it is... how can i only check the hour and put that as my intiger like if it's 7:37:05 how can i just see the 7 or just the 37 not all 7:37:05 at the same time.... cuz if i just go

text2.text = thetime - 7

i get an error and it won't work


plz help
thx in advance


Report Offensive Follow Up For Removal

Response Number 2
Name: egkenny
Date: October 7, 2003 at 21:05:17 Pacific
Reply: (edit)

Private Sub Form_Load()
Timer1.Interval = 250 ' Set Timer interval
End Sub

Private Sub Timer1_Timer()
LocalTime = Time
Text1.Text = Format(LocalTime, "hh:mm:ss")
HourDifference = 6
OtherTime = DateAdd("h", HourDifference, LocalTime)
Text2.Text = Format(OtherTime, "hh:mm:ss")
End Sub


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software