Solved

Time

Posted on 2006-07-12
10
291 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 53
Question about INSTR  - need to extract data MS ACCESS query 6 54
Add a task in Outlook from access 11 39
Spell Check in VB6 13 112
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

776 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