0

I was wondering how you would display the time in hour/minutes/seconds and then depending on what time of the day it is, it displays the relevant label e.g. Good morning, good afternoon etc

thanks

2
Contributors
3
Replies
8
Views
7 Years
Discussion Span
Last Post by AndreRet
0

I have used 2 timers, one to show the time, a second to check for morning or afternoon -

Private Sub Timer1_Timer()

Label1.Caption = Format$(Time, "hh:mm:ss AM/PM")
End Sub

Private Sub Timer2_Timer()

If Hour(Now) >= 12 Then
Label1.ForeColor = vbBlue
End If
End Sub

This should answer your question.

0
currentTime = Format(Now(), "hh:mm")

If currentTime > "12:00" Then
    Label12.Caption = "Good Afternoon"
Else
    Label12.Caption = "Good Morning"
End If

I ended up using this, thanks anyway

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.