944,000 Members | Top Members by Rank

Ad:
Nov 5th, 2007
0

Facing problem with creating different timezone on a vb form

Expand Post »
Please note this is in Visual Basic 6.0 language not .net :

I am facing alot of probem while creating a program which can show 5 different timezone of US on a form on 5 different label in connection with the system time.

for Eg
label1.caption "should be IST" Indian stan time
label2.caption "should be GMT" Green wich mean time
label3.caption "should be PST" Pacific Time
label4.caption "should be MST" Mountain Time
label5.caption "should be EST" Eastern time

This should work in connection with the system time, for eg: if its 18:00 hrs system time here, then EST ie: Label3.caption should be 08:00 hrs. 6 hours before our time.

Any help would really be appreciated.
Last edited by mohammadhaneef; Nov 5th, 2007 at 4:36 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mohammadhaneef is offline Offline
3 posts
since Nov 2007
Nov 5th, 2007
0

Re: Facing problem with creating different timezone on a vb form

What will you consider as the base time?
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Nov 5th, 2007
0

Re: Facing problem with creating different timezone on a vb form

If you know the base time then based on the current time you can use something like this:

Assuming EST as the base time

CST = DateAdd("h", -1, Now)
MST = DateAdd("h", -2, Now)
PST = DateAdd("h", -3, Now)

So on..
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Nov 5th, 2007
0

Re: Facing problem with creating different timezone on a vb form

If you know the base time then based on the current time you can use something like this:

Assuming EST as the base time

CST = DateAdd("h", -1, Now)
MST = DateAdd("h", -2, Now)
PST = DateAdd("h", -3, Now)

So on..
Base time would be the system time
and label should display the time 6 HOURS before the system time and so on.

system time 18:20:20 the Label time should be
12:20:20 hrs.

Based on reply would this code fetch me the Date or Time or Both. Please reply in detail
Last edited by mohammadhaneef; Nov 5th, 2007 at 5:26 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mohammadhaneef is offline Offline
3 posts
since Nov 2007
Nov 6th, 2007
0

Re: Facing problem with creating different timezone on a vb form

Base time would be the system time
and label should display the time 6 HOURS before the system time and so on.

system time 18:20:20 the Label time should be
12:20:20 hrs.

Based on reply would this code fetch me the Date or Time or Both. Please reply in detail
Thanks buddy the code worked as told be you but there is a slight problem with the minutes as that remains the same (The hour time increases or decreases but the minutes dont change) unfortunate enough I tried other alterations but it wont accept.

Please see if you can help,

If the Base time is 18:00:00 then the form time should be 06:30:00.

Thanks again
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mohammadhaneef is offline Offline
3 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to using a variable in a database connection
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Visual basic 6 picture background problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC