hour vb.net

1912Dummy's Avatar, Join Date: Mar 2013
Newbie Member
Hello,
does anyone known's why this don't work?
Code:
Dim d As DateTime = DateTime.Now
        Dim time = d.Hour
        If (time < 12) Then

            lbltime.Text = "Good Morning"

        ElseIf (time >= 12 Or time < 18) Then

            lbltime.Text = "Good Afternoon"

        ElseIf (time >= 18 Or time < 23) Then
            lbltime.Text = "Good Evening"
        Else
            lbltime.Text = "Good Night"

        End If
even when the time is 19h it still says good afternoon instead of good evening
anyone please?

thanks
0
1912Dummy's Avatar, Join Date: Mar 2013
Newbie Member
well thanks anyway guys
i got it working.

Code:
Dim d As DateTime = DateTime.Now
        Dim time = d.Hour

        If (time >= 6 And time < 12) Then

            lbltime.Text = "Good Morning"

        ElseIf (time >= 12 And time < 18) Then

            lbltime.Text = "Good Afternoon"

        ElseIf (time >= 18 And time < 23) Then
            lbltime.Text = "Good Evening"
        Else
            lbltime.Text = "Good Night"

        End If
shabbir like this