'   Declarations
        Dim dtNow As DateTime = DateTime.Now
        Dim intHour As Integer = Now.Hour
        Dim intMin As Integer = Now.Minute
        Dim intSec As Integer = Now.Second

        '  Logic
        If intHour < 12 Then
            lblGreeting.Text = "Good Morning"
        ElseIf intHour > 12 & intHour < 18 Then
            lblGreeting.Text = "Good Afternoon!"
        Else
            lblGreeting.Text = "Good Evening!"
        End If

        '   <summary>
        '   Sample examples of DateTime Strings you can use
        '   
        '   DateTime String                 Sample Result
        '       "D"                     Thursday, February 01, 2001
        '       "d"                     2/01/2001
        '       "f"                     Thursday, February 01, 2001 4:32 PM
        '       "F"                     Thursday, February 01, 2001 4:32:30 PM
        '       "g"                     2/01/2001 4:32 PM
        '       "G"                     2/01/2001 4:32:30 PM
        '       "m"                     February 01
        '       "t"                     4:32 PM
        '       "T"                     4:32:30 PM
        '       "dddd, MMMM dd yyyy"    Thursday, February 01 2001
        '   
        '   </summary>

        lblDate.Text = "The Current Date and Time is: " + Now.ToString("F")
2
Contributors
1
Reply
4
Views
12 Years
Discussion Span
Last Post by a.j.
0

THANX MAN....this is a good one. after i saw smone code a clock in VB....I always wanted to know how that works b'cos i noticed that everytime it run, it was synchronized with the time on the pc.
thanx for opening ma mind, thanx


Aj..

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.