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.

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..

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

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

This article has been dead for over six months. Start a new discussion instead.