Results 1 to 4 of 4

Thread: Need Urgent Help!!! - VB6 - Time function Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    2

    Question Need Urgent Help!!! - VB6 - Time function Help

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

  2. #2
    Addicted Member ThorSubak's Avatar
    Join Date
    Apr 2008
    Location
    Cebu
    Posts
    153

    Re: Need Urgent Help!!! - VB6 - Time function Help

    did you have a formula on calculating those time?
    what is your base time? we will start on it.

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Need Urgent Help!!! - VB6 - Time function Help

    User DateAdd like this:
    Code:
    Label2.Caption = DateAdd("n", 19, DateAdd("h", 15, Now))

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    2

    Re: Need Urgent Help!!! - VB6 - Time function Help

    i got it figured out - long shot but it works

    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width