Solved

Time

Posted on 2006-07-12
10
294 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:TheSonics
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 10

Expert Comment

by:fostejo
ID: 17094798
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,
0
 
LVL 9

Accepted Solution

by:
justchat_1 earned 43 total points
ID: 17096537
why use an api call?-vb has a bult in local time function
0
 
LVL 4

Assisted Solution

by:jomacinc
jomacinc earned 41 total points
ID: 17096903
I agree with justchat_1

{SystemTime} = Time()
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Assisted Solution

by:Ryan_R
Ryan_R earned 41 total points
ID: 17151751
just to make it easier like said above

myVariable = Time

will give you the current system time

while we're here you can also use

myVariable = Date
for the obvious result (system date given)
0
 
LVL 4

Expert Comment

by:jomacinc
ID: 17292175
IMO justchat_1 posted the correct answer and the rest of us just clarified it.
0
 
LVL 15

Expert Comment

by:Ryan_R
ID: 17292610
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
0
 
LVL 15

Expert Comment

by:Ryan_R
ID: 17292622
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)
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question