Link to home
Start Free TrialLog in
Avatar of TheSonics
TheSonics

asked on

Time

Ok here it goes:

Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
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



in F()
 Dim SysTime As SYSTEMTIME
   GetSystemTime SysTime


I get 20:00:00 instead of 16:00:00, so i do i get the computer time ? looks like this is givie global time.
Avatar of fostejo
fostejo

TheSonics,

GetSystemTime return the time in Coordinated Universal Time (UTC) - if you need to return the current *Local* time, you'll need to use the GetLocalTime API instead (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getlocaltime.asp)

Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/local_time.asp for more information or http://www.thescripts.com/forum/thread191443.html for an example of a script to show 'both' times.

cheers,
ASKER CERTIFIED SOLUTION
Avatar of justchat_1
justchat_1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
IMO justchat_1 posted the correct answer and the rest of us just clarified it.
i agree, however it may be reasonable to conclude that a COMPLETE BEGINNER wouldn't really be able to apply the suggestion of justchat_1 without a vb6 example statement as you and I both clarified - maybe split between the two of you

Ryan R
oh and while we're all here why don't we go even more specific

you can also use the vbHour, vbMinute, and vbSecond functions to provide the individual results (although i belive the vbHour uses 24-hour format)