Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


API: GetLocalTime


API: GetLocalTime

Author
Message
kwandobe
kwandobe
Forum God
Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)

Group: Forum Members
Posts: 22, Visits: 4

I am using this code and this private type to bring back the current time, but I want it to show whether it is AM or PM also, though I forget what I would name the parameter.

 

Public Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

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
    wAM As Integer
End Type

Public Sub DisplayClock(frm As Form)
    Dim MyTime As SYSTEMTIME
    frm.AutoRedraw = True
    GetLocalTime MyTime
       Dim wSecond, wMinute As Integer
       wSecond = MyTime.wSecond
       wMinute = MyTime.wMinute
       If Len(wSecond) = 1 Then
          wSecond = "0" & wSecond
       End If
       If Len(wMinute) = 1 Then
          wMinute = "0" & wMinute
       End If
    MyForm.n_Clock.Caption = MyTime.wHour & ":" & wMinute & ":" & wSecond & " " & MyTime.wAM
End Sub



-kwandobe


kwandobe
kwandobe
Forum God
Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)

Group: Forum Members
Posts: 22, Visits: 4
This API call brings back military time, I can figure out how to convert it, please disregard this post.

-kwandobe


Booooze
Booooze
Forum God
Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)

Group: Forum Members
Posts: 827, Visits: 132
you could also try this, not sure if its what you'd like though.

'Show Time in text box.
text1.text = Time
'Show Date in text box.
text2.text = Date

API Guide|Inno Setup Wizard|Winsockvb|StudioTraffic|Firefox
kwandobe
kwandobe
Forum God
Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)Forum God (5.9K reputation)

Group: Forum Members
Posts: 22, Visits: 4
Duhh I should have known it were that easy? No thanks though, I like to use up resources LOL

-kwandobe


Booooze
Booooze
Forum God
Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)Forum God (154K reputation)

Group: Forum Members
Posts: 827, Visits: 132
lol, have it your way then:p

API Guide|Inno Setup Wizard|Winsockvb|StudioTraffic|Firefox
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search