|
-
Mar 6th, 2002, 01:56 PM
#1
How do I use GetLocalTime?
I wrote a VB6 app that uses date parts--DatePart("h", Now), but this part of the program does not appear to work on machines running Windows 95.
I was told to use an API call and was given this text:
Public 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
Dim ST as SYSTEMTIME
GetLocalTime ST
How do I use this info? Does it all go in a module? Is anything missing? Is there a better way to get current date and time parts that is supported by Windows 95?
Thanks!
-
Mar 6th, 2002, 01:58 PM
#2
How about something easy like
-
Mar 6th, 2002, 04:21 PM
#3
Code:
Private Declare Sub GetLocalTime 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
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim MyTime As SYSTEMTIME
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Get the local time
GetLocalTime MyTime
'Print it to the form
Me.Print "The Local Date is:" & MyTime.wMonth & "-" & MyTime.wDay & "-" & MyTime.wYear
Me.Print "The Local Time is:" & MyTime.wHour & ":" & MyTime.wMinute & ":" & MyTime.wSecond
End Sub
-
Mar 7th, 2002, 12:18 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|