PDA

Click to See Complete Forum and Search --> : Need Urgent Help!!! - VB6 - Time function Help


patel_ravi
Mar 20th, 2008, 10:11 PM
Hi guys,

I am desperately looking for help in one of my project - been stuck on the issue from long time and fail to find solution myself... Help will be really appreciated.

Let me get to the point. I am creating the application with:

5 labels and 1 timer

1st label caption is current time on my system
and it is refreshed every second by timer

Now i want 2nd to 5th label have time for different time zones in US by deducting time difference between my location and US time zones.

for example:
if time here on system is <20th March, 2008 08:00:00> then the current time by Pacific Time Zone in US will be <19th March, 2008 21:14:00> means PST is around 15 Hours and 19 minutes behind my time zone.

How can i write a code to deduct 15 hours and 19 minutes from the time on 1st label and then display the return value on 2nd label and vice versa.

Please HELP ME!!:confused: :confused: :(

ThorSubak
Apr 16th, 2008, 08:22 AM
did you have a formula on calculating those time?
what is your base time? we will start on it.

CVMichael
Apr 16th, 2008, 08:54 AM
User DateAdd like this:

Label2.Caption = DateAdd("n", 19, DateAdd("h", 15, Now))

patel_ravi
Apr 16th, 2008, 02:58 PM
i got it figured out - long shot but it works

AlaskaTimeZone.Caption = Format(CDate(Time$) + TimeSerial(a_h, a_m, 0), "HH:NN:SS AM/PM")
HawaiiTimeZone.Caption = Format(CDate(Time$) + TimeSerial(h_h, h_m, 0), "HH:NN:SS AM/PM")
PacificTimeZone.Caption = Format(CDate(Time$) + TimeSerial(p_h, p_m, 0), "HH:NN:SS AM/PM")
MountianTimeZone.Caption = Format(CDate(Time$) + TimeSerial(m_h, m_m, 0), "HH:NN:SS AM/PM")
CentralTimeZone.Caption = Format(CDate(Time$) + TimeSerial(c_h, c_m, 0), "HH:NN:SS AM/PM")
EasternTimeZone.Caption = Format(CDate(Time$) + TimeSerial(e_h, e_m, 0), "HH:NN:SS AM/PM")


where a_h, h_h, p_h, m_h, c_h, e_h are difference in hours
and a_m, h_m, p_m, c_m, e_m are difference in minute

cannot explain but somehow its give me exact time in that time zones which matches with htt://www.time.gov

i have difference in hour and minutes stored as integer in database and when there is daylight saving i go in data base and change the difference and it reflect in application.

Thanks for the reply though