?
Solved

Time

Posted on 2006-07-12
10
Medium Priority
?
297 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
7 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 172 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 164 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 164 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

862 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