Results 1 to 3 of 3

Thread: Local Time To GMT

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Cool

    How can I know the difference between the local PC time and the GMT time?

    Any idea?

    Any Help?


  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Here you are....

    Code:
    Option Explicit
    
    
    Private Type SYSTEMTIME
      wYear As Integer
      wMonth As Integer
      wDayOfWeek As Integer
      wDay As Integer
      wHour As Integer
      wMinute As Integer
      wSecond As Integer
      wMilliseconds As Integer
    End Type
    Private Declare Sub GetSystemTime Lib "kernel32.dll" (lpSystemTime As SYSTEMTIME)
    
    
    Private Sub Command1_Click()
    Dim utctime  As SYSTEMTIME
    
    GetSystemTime utctime  ' put the time and date in UTC time into utctime
    'Debug.Print "In Greenwich, England, the time is"; utctime.wHour; ":"; utctime.wMinute; ":"; utctime.wSecond
    
    
    Debug.Print "Time Difference: " & Val(Format(Now, "h")) - utctime.wHour & " hour"
    
    End Sub
    Mark
    -------------------

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    It works, thanks a lot.

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