displaying date and time

karthikeyan

Member
Joined
Oct 22, 2005
Messages
12
Programming Experience
Beginner
hi,

iam working in vb.net
i want code ofr this:

while loading the form the date and time has to display in label
what to do
 
Label1.Text = Today & Now

or something like that anyways, there's the Now and the Today keywords you can use to get the date&time
there's also built-in formats you can use to specify long dates and short times and stuff too
 
Date and Time display

Dim dt As Date = DateTime.Now
Label1.Text = dt.ToString

to keep current time add a timer with interval of 1000

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim dt As Date = DateTime.Now
Label1.Text = dt.ToString
End Sub
 
Back
Top