How do you display the system date and time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Stark

    #1

    How do you display the system date and time

    I want to display the date and time in the long date format
    as a form load event. Do I need to link it to a label or a text box?
    Code:
    Public Class Form1
        'Form load event display date and time
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim dtmSystemDate As Date = Now 'declare variable for Date
            Dim strNow As String = Now().ToString("D")
        End Sub
    Thanks
    ds
  • danp129
    Recognized Expert Contributor
    • Jul 2006
    • 323

    #2
    This belongs in Visual Basic.Net forum.

    Which control to use is up to you. I would use a label probably if the user cannot change the date.

    If you go with a label called Label1 then you set it as follows:
    Code:
    Label1.Text=Now().ToString("D")

    Comment

    Working...